Skip to content

ci: add sonatype release to GHA #1521

ci: add sonatype release to GHA

ci: add sonatype release to GHA #1521

Workflow file for this run

name: unit tests
on: [push, pull_request]
concurrency:
group: unittest-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Unit Tests
runs-on: ubuntu-24.04
environment: github-actions
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup Scala
uses: olafurpg/setup-scala@v12
with:
java-version: adopt-openj9@1.8.0-292
- name: Cache .ivy2
uses: actions/cache@v4
with:
path: ~/.ivy2
key: ${{ runner.os }}-ivy2-${{ hashFiles('**/build.sbt') }}
- name: Cache .sbt
uses: actions/cache@v4
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.properties') }}
- name: Unit Tests
run: |
set -e
sbt +clean coverage +test && sbt coverageReport coverageAggregate && (find $HOME/.sbt -name "*.lock" | xargs rm) && (find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm)
- name: Code Coverage
uses: codecov/codecov-action@v5.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
release:
if: ${{ github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main' }}
needs: test
runs-on: ubuntu-24.04
environment: github-actions
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Scala
uses: olafurpg/setup-scala@v12
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 == 'pull_request' || (github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# 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: ${{ github.event_name == 'pull_request' }}
- name: Generate gh-pages preview (pull request only)
uses: rossjrw/pr-preview-action@df22037db54ab6ee34d3c1e2b8810ac040a530c6 # v1.6.0
if: ${{ github.event_name == 'pull_request' }}
with:
source-dir: ./build
- name: Commit generated docs (main only)
uses: nick-fields/retry@v3
#i.e. if: ${{ github.event_name != 'pull_request' }}
if: ${{ github.repository == 'fulcrumgenomics/fgbio' && github.ref == 'refs/heads/main' }}
with:
shell: bash -l {0}
max_attempts: 5
retry_on: error
polling_interval_seconds: 5
timeout_minutes: 5
command: |
pushd gh-pages
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: ${{ github.head_ref }}" --author "Nobody <nobody@fulcrumgenomics.com>" || echo "nothing to commit"
git rebase origin/gh-pages
git fetch origin
git push --atomic --set-upstream origin gh-pages
popd