Skip to content

refactor test

refactor test #20

Workflow file for this run

name: CI
env:
JAVA_OPTS: "-Dfile.encoding=UTF-8 -Xms1024M -Xmx3072M -Xss4M -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler"
on:
push:
branches: '*'
tags: [ "v[0-9]+*" ]
pull_request:
# avoid duplicate checks (push & PR) further in the review process
types: [opened]
jobs:
test:
name: Run tests
runs-on: ubuntu-20.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
strategy:
fail-fast: false
matrix:
scala: [ 2.12.14, 2.13.6 ]
command: [ test ]
steps:
- uses: actions/checkout@v2
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache
~/.cache/coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}-${{ hashFiles('project/Dependencies.scala') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache npm
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Set up node
uses: actions/setup-node@v2-beta
- name: Run tests
run: sbt "set concurrentRestrictions in Global += Tags.limit(ScalaJSTags.Link, 1)" ++${{ matrix.scala }} ${{ matrix.command }}
publish:
name: Publish to Sonatype
# only run on tag push
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v'))
needs: [ test ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache
~/.cache/coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}-${{ hashFiles('project/Dependencies.scala') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get version
id: get_tag_name
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Import GPG key
env:
#exported via `gpg -a --export-secret-keys <key> | cat -e | sed 's/\$/\\n/g' | xclip -selection clipboard` and added to org secrets
SONATYPE_GPG: ${{ secrets.SONATYPE_GPG }}
run: echo -e $SONATYPE_GPG | gpg --import -
- name: Publish artifacts
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: sbt 'set version in ThisBuild := "${{ steps.get_tag_name.outputs.VERSION }}"' +publishSigned
- name: Release Sonatype bundle
#https://github.com/xerial/sbt-sonatype#publishing-your-artifact
if: ${{ !endsWith(steps.get_tag_name.outputs.VERSION, 'SNAPSHOT') }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: sbt 'set version in ThisBuild := "${{ steps.get_tag_name.outputs.VERSION }}"' sonatypeBundleRelease