Kvg sample and cohort wdls (#49) #106
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: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Write commit message | |
run: git log --format=%B -n 1 ${{ github.event.after }} > release_notes.txt | |
- name: Github Bumpversion Action | |
id: version-bump | |
uses: jasonamyers/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: "patch" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Build Rust binary | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
run: | | |
cargo build --release | |
strip target/release/hidive | |
sccache --show-stats | |
# - name: Upload binary as artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: hidive-${{ steps.version-bump.outputs.new_ver }} | |
# path: target/release/hidive | |
- name: Create Github release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.version-bump.outputs.new_ver }} | |
release_name: 'v${{ steps.version-bump.outputs.new_ver }}' | |
body_path: "release_notes.txt" | |
draft: false | |
prerelease: false | |
# - name: Upload Release Asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./target/release/hidive | |
# asset_name: hidive-${{ steps.version-bump.outputs.new_ver }} | |
# asset_content_type: application/octet-stream | |
- name: Authenticate to Google Cloud | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.repository }}-${{ hashFiles('docker/**') }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ github.repository }}- | |
${{ runner.os }}-buildx- | |
- name: Configure Docker to use gcloud credentials | |
run: gcloud auth configure-docker us.gcr.io -q | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker | |
push: true | |
tags: us.gcr.io/broad-dsp-lrma/lr-hidive:${{ steps.version-bump.outputs.new_ver }} | |
build-args: | | |
branch=v${{ steps.version-bump.outputs.new_ver }} | |
cache-from: | | |
type=local,src=/tmp/.buildx-cache | |
type=gha,scope=${{ github.workflow }} | |
cache-to: | | |
type=local,dest=/tmp/.buildx-cache-new,mode=max | |
type=gha,mode=max,scope=${{ github.workflow }} | |
build-contexts: | | |
binary=./target/release | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |