Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to sbt-typelevel-ci-release #597

Merged
merged 8 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 155 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,66 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Continuous Integration

on:
pull_request:
branches: ['**']
push:
branches: ['master']
tags: ['v*']
branches: ['**']
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPARK_LOCAL_IP: localhost

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8]
java: [8]
distribution: [temurin]
scala: [2.13.8, 2.12.15]
java: [temurin@8]
project: [root-spark30, root-spark31, root-spark32]
exclude:
- scala: 2.13.8
project: root-spark30
- scala: 2.13.8
project: root-spark31
runs-on: ${{ matrix.os }}
env:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v2
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Python
uses: actions/setup-python@v2
Expand All @@ -37,83 +70,142 @@ jobs:
- name: Setup codecov
run: pip install codecov

- name: Check that workflows are up to date
run: sbt '++${{ matrix.scala }}' 'project ${{ matrix.project }}' 'project /' githubWorkflowCheck

- name: Test & Compute Coverage
run: sbt ++${{ matrix.scala }} coverage frameless-test
run: sbt '++${{ matrix.scala }}' 'project ${{ matrix.project }}' coverage test test/coverageReport

- name: Test & Compute Coverage Spark 3.1.x
run: sbt ++${{ matrix.scala }} coverage frameless-test-spark31
- name: Check binary compatibility
run: sbt '++${{ matrix.scala }}' 'project ${{ matrix.project }}' mimaReportBinaryIssues

- name: Test & Compute Coverage Spark 3.0.x
run: sbt ++${{ matrix.scala }} coverage frameless-test-spark30
- name: Generate API documentation
run: sbt '++${{ matrix.scala }}' 'project ${{ matrix.project }}' doc

- name: Upload Codecov Results
run: codecov -F ${{ matrix.scala }}

- name: Binary compatibility check
run: sbt ++${{ matrix.scala }} frameless-mimaReportBinaryIssues
- name: Make target directories
run: mkdir -p refined-spark30/target refined/target ml-spark30/target target mdocs/target ml-spark31/target refined-spark31/target .spark31/target ml/target cats-spark31/target dataset-spark31/target dataset/target cats-spark30/target .spark30/target .spark32/target cats/target core/target dataset-spark30/target project/target

- name: Compress target directories
run: tar cf targets.tar refined-spark30/target refined/target ml-spark30/target target mdocs/target ml-spark31/target refined-spark31/target .spark31/target ml/target cats-spark31/target dataset-spark31/target dataset/target cats-spark30/target .spark30/target .spark32/target cats/target core/target dataset-spark30/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
strategy:
matrix:
os: [ubuntu-latest]
java: [8]
distribution: [temurin]
scala: [2.12.15]
java: [temurin@8]
runs-on: ${{ matrix.os }}
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
CI_SNAPSHOT_RELEASE: "frameless-publish"
CI_RELEASE: "frameless-publishSigned"

steps:
- uses: actions/checkout@v2
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 8

- name: Cache sbt
uses: actions/cache@v2
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}

# Sequentially publish different artifacts for different Scala versions.
# Doing that in parallel may cause unclosed staging repositories drop.
- name: Publish Scala 2.12.15 artifacts
run: sbt ++$SCALA_VERSION ci-release
env:
SCALA_VERSION: 2.12.15
if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }}

- name: Publish Scala 2.13.8 artifacts
run: sbt ++$SCALA_VERSION ci-release
env:
SCALA_VERSION: 2.13.8
if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }}

docs:
name: Documentation
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.8)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.8-${{ matrix.java }}

- name: Inflate target directories (2.13.8)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.15)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }}

- name: Inflate target directories (2.12.15)
run: |
tar xf targets.tar
rm targets.tar

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -d | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -d > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)

- name: Publish
run: sbt '++${{ matrix.scala }}' tlRelease

site:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15]
java: [8]
distribution: [temurin]
java: [temurin@8]
runs-on: ${{ matrix.os }}
env:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v2
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

- name: Documentation
run: sbt ++${{ matrix.scala }} doc mdoc
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Generate site
run: sbt '++${{ matrix.scala }}' tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: mdocs/target/docs/site
publish_branch: gh-pages
Loading