Skip to content
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
141 changes: 92 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,31 @@ on:
branches: ['**']
push:
branches: ['**']
tags: [v*, v*]
tags: [v*]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
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 }}

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.1.0]
scala: [2.12.15, 3.1.0, 2.13.8]
java: [temurin@8, temurin@17]
project: [rootJS, rootJVM]
exclude:
- scala: 2.12.15
java: temurin@17
- scala: 3.1.0
java: temurin@17
- project: rootJS
java: temurin@17
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -61,42 +70,30 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Ruby
if: matrix.scala == '2.12.15'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.0

- name: Install microsite dependencies
if: matrix.scala == '2.12.15'
run: |
gem install saas
gem install jekyll -v 4.2.0

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

- name: Check formatting
run: sbt ++${{ matrix.scala }} scalafmtCheckAll scalafmtSbtCheck
- name: Check headers and formatting
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Check binary issues
run: sbt ++${{ matrix.scala }} mimaReportBinaryIssues
- name: fastOptJS
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/fastOptJS

- name: Compile
run: sbt ++${{ matrix.scala }} Test/compile
- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

- name: Run tests
run: sbt ++${{ matrix.scala }} test
- name: Check binary compatibility
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues

- name: Build the Scaladoc
run: sbt ++${{ matrix.scala }} doc
- name: Generate API documentation
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc

- name: Build the Microsite
if: matrix.scala == '2.12.15'
run: sbt ++${{ matrix.scala }} docs/makeMicrosite
- name: Make target directories
run: mkdir -p target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target

- name: Compress target directories
run: tar cf targets.tar target core/.js/target core/.jvm/target project/target
run: tar cf targets.tar target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand All @@ -107,7 +104,7 @@ jobs:
publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -156,41 +153,87 @@ jobs:
tar xf targets.tar
rm targets.tar

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

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

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

- name: Inflate target directories (3.1.0)
- name: Inflate target directories (2.13.8)
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: Setup Ruby
uses: ruby/setup-ruby@v1
- 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.13.8]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

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

- name: Install microsite dependencies
run: |
gem install saas
gem install jekyll -v 4.2.0
- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17

- name: Release
run: sbt ++${{ matrix.scala }} release
- 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 microsite
run: sbt ++${{ matrix.scala }} ++2.12.15 docs/publishMicrosite
- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
publish_branch: gh-pages
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rewrite {
runner.dialect = "scala213source3"

fileOverride {
"glob:**/scala-3.x/src/main/scala/**" {
"glob:**/scala-3/**" {
runner.dialect = scala3
}
}
Loading