Add test with threading #1916
Workflow file for this run
This file contains hidden or 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: unit tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_call: | |
| secrets: | |
| CODECOV_TOKEN: | |
| required: true | |
| SONATYPE_USER: | |
| required: false | |
| SONATYPE_PASS: | |
| required: false | |
| concurrency: | |
| group: unittest-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| jvm: ["temurin:1.8.0-442", "temurin:1.11.0.27", "temurin:1.17.0.15", "temurin:1.21.0.7", "temurin:1.22.0.2"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Checkout LFS objects | |
| run: git lfs checkout | |
| - name: Setup cache | |
| uses: coursier/cache-action@4e2615869d13561d626ed48655e1a39e5b192b3c # v6.4.7 | |
| - name: setup Scala | |
| uses: coursier/setup-action@039f736548afa5411c1382f40a5bd9c2d30e0383 # v1.3.9 | |
| with: | |
| apps: scala:2.13.14 scalac:2.13.14 scaladoc:2.13.14 sbt:1.10.1 | |
| jvm: ${{ matrix.jvm }} | |
| - name: Unit Tests | |
| run: | | |
| set -e | |
| sbt clean coverage test | |
| sbt coverageReport coverageAggregate | |
| - name: Code Coverage | |
| uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unittests # optional | |
| fail_ci_if_error: true # optional (default = false) | |
| verbose: true # optional (default = false) | |
| # while the "docs" job below tests building the online docs, this is added here | |
| # to fail-fast when docs are not correctly written. | |
| - name: Ensure docs will compile (fast-fail) | |
| run: | | |
| set -e | |
| sbt doc | |
| release: | |
| if: ${{ github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main' && github.event_name != 'workflow_call' }} | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: github-actions | |
| env: | |
| SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
| SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| # TODO: The setup-scala action is deprecated and should be migrated to actions/setup-java or coursier/setup-action! | |
| - name: Setup Scala | |
| uses: olafurpg/setup-scala@32ffa16635ff8f19cc21ea253a987f0fdf29844c # v14 | |
| with: | |
| java-version: adopt-openj9@1.8.0-292 | |
| - name: Upload to Sonatype | |
| run: | | |
| sbt +publish | |
| docs: | |
| name: Generate tool and metric markdown docs | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'workflow_call' && (github.event_name == 'pull_request' || (github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main')) }} | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| # To work with the `pull_request` or any other non-`push` even with git-auto-commit | |
| ref: ${{ github.head_ref }} | |
| - name: Generate the docs | |
| uses: ./.github/actions/docs/ | |
| with: | |
| build-dir: ./build | |
| latest: false | |
| - name: Generate gh-pages preview (pull request only) | |
| uses: rossjrw/pr-preview-action@2fb559e4766555e23d07b73d313fe97c4f8c3cfe # v1.6.1 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| source-dir: ./build | |
| - name: Commit generated docs (main only) | |
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 | |
| #i.e. if: ${{ github.event_name != 'pull_request' }} | |
| if: ${{ github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main' }} | |
| with: | |
| max_attempts: 5 | |
| retry_on: error | |
| polling_interval_seconds: 5 | |
| timeout_minutes: 5 | |
| command: | | |
| set -euo pipefail | |
| pushd ./build | |
| git add tools metrics index.md | |
| git config --global user.name "Github Actions" | |
| git config --global user.email "nobody@fulcrumgenomics.com" | |
| git commit --all --message "devel: ${{ steps.checkout.outputs.ref }}" --author "Nobody <nobody@fulcrumgenomics.com>" || echo "nothing to commit" | |
| git fetch origin gh-pages | |
| git rebase -X ours origin/gh-pages | |
| git push --atomic --set-upstream origin gh-pages | |
| popd | |
| new_command_on_retry: | | |
| set -euo pipefail | |
| pushd ./build | |
| git fetch origin gh-pages | |
| git rebase --abort | |
| git rebase -X ours origin/gh-pages | |
| git push --atomic --set-upstream origin gh-pages | |
| popd |