Add test to sbt #2900
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scala CI | |
on: [push] | |
jobs: | |
scala-ci: | |
runs-on: ${{ matrix.config.os }} | |
if: "!contains(github.event.head_commit.message, 'ci skip')" | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { name: 'ubuntu_latest', os: ubuntu-latest } | |
- { name: 'macos_latest', os: macos-latest } | |
java: | |
- { ver: '11', run_nextflow: true, run_coverage: false } | |
- { ver: '17', run_nextflow: true, run_coverage: true } | |
- { ver: '20', run_nextflow: false, run_coverage: false } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: viash-io/viash-actions/update-docker-engine@v4 | |
if: runner.os == 'Linux' | |
- name: Set up Nextflow | |
if: ${{ runner.os == 'Linux' && matrix.java.run_nextflow }} | |
run: | | |
mkdir -p "$HOME/.local/bin" | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
curl -s https://get.nextflow.io 2> /dev/null | bash > /dev/null | |
mv nextflow "$HOME/.local/bin" | |
nextflow -version | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Set up R dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | | |
processx | |
testthat | |
- name: Set up sbt | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java.ver }} | |
- name: Set up Scala | |
run: | | |
if [[ "${{ matrix.config.os }}" =~ ^macos.*$ ]]; then | |
brew install scala | |
else | |
sudo apt-get update | |
sudo apt-get install -y scala | |
fi | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Run tests | |
run: | | |
if [[ "${{ matrix.config.name }}" =~ ^ubuntu.*$ ]] && [[ "${{ matrix.java.run_coverage }}" == "true" ]]; then | |
# only run coverage on main runner | |
sbt clean coverage test coverageReport | |
elif [[ "${{ matrix.config.name }}" =~ ^ubuntu.*$ ]] && [[ "${{ matrix.java.run_nextflow }}" == "false" ]]; then | |
sbt 'testOnly -- -l io.viash.NextflowTest' | |
elif [[ "${{ matrix.config.os }}" =~ ^macos.*$ ]]; then | |
# macOS on github actions does not have Docker, so skip those | |
sbt 'testOnly -- -l io.viash.DockerTest -l io.viash.NextflowTest' | |
else | |
sbt test | |
fi | |
- name: Upload coverage on success | |
run: bash <(curl -s https://codecov.io/bash) | |
- name: Upload check results on fail | |
if: failure() | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ matrix.config.name }}_results | |
path: check |