Run RSeQC R plot scripts after each tool in benchmark runner #3
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v[0-9]+.*" | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # ------------------------------------------------------------------ | |
| # 1. Create a draft GitHub release | |
| # ------------------------------------------------------------------ | |
| create-release: | |
| name: Create release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.tag.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get tag | |
| id: tag | |
| run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| - name: Create draft release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create "${{ steps.tag.outputs.tag }}" --draft --verify-tag --title "${{ steps.tag.outputs.tag }}" | |
| # ------------------------------------------------------------------ | |
| # 2. Build binaries for each target | |
| # ------------------------------------------------------------------ | |
| build-binaries: | |
| name: Build ${{ matrix.name }} | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: create-release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 | |
| - name: linux-x86_64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| use-cross: false | |
| # Linux aarch64 | |
| - name: linux-aarch64 | |
| os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| use-cross: true | |
| # macOS x86_64 | |
| - name: macos-x86_64 | |
| os: macos-13 | |
| target: x86_64-apple-darwin | |
| use-cross: false | |
| # macOS aarch64 (Apple Silicon) | |
| - name: macos-aarch64 | |
| os: macos-latest | |
| target: aarch64-apple-darwin | |
| use-cross: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| # Linux build dependencies (native) | |
| - name: Install Linux build deps | |
| if: runner.os == 'Linux' && !matrix.use-cross | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake zlib1g-dev libbz2-dev liblzma-dev \ | |
| libcurl4-openssl-dev libssl-dev libfontconfig1-dev pkg-config clang | |
| # macOS build dependencies | |
| - name: Install macOS build deps | |
| if: runner.os == 'macOS' | |
| run: brew install bzip2 xz | |
| # Cross (for Linux aarch64) | |
| - name: Install cross | |
| if: matrix.use-cross | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cross | |
| - name: Build | |
| run: | | |
| if [ "${{ matrix.use-cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: Package | |
| id: package | |
| run: | | |
| BIN="rustqc" | |
| ARCHIVE="${BIN}-${{ matrix.name }}" | |
| mkdir -p "staging/${ARCHIVE}" | |
| cp "target/${{ matrix.target }}/release/${BIN}" "staging/${ARCHIVE}/" | |
| cp README.md LICENSE "staging/${ARCHIVE}/" 2>/dev/null || true | |
| cd staging | |
| tar czf "../${ARCHIVE}.tar.gz" "${ARCHIVE}" | |
| cd .. | |
| # SHA256 checksum | |
| shasum -a 256 "${ARCHIVE}.tar.gz" > "${ARCHIVE}.tar.gz.sha256" | |
| echo "archive=${ARCHIVE}.tar.gz" >> "$GITHUB_OUTPUT" | |
| echo "checksum=${ARCHIVE}.tar.gz.sha256" >> "$GITHUB_OUTPUT" | |
| - name: Upload to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload "${{ needs.create-release.outputs.tag }}" \ | |
| "${{ steps.package.outputs.archive }}" \ | |
| "${{ steps.package.outputs.checksum }}" | |
| # ------------------------------------------------------------------ | |
| # 3. Build & push Docker image to GHCR | |
| # ------------------------------------------------------------------ | |
| docker: | |
| name: Docker image | |
| if: always() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # ------------------------------------------------------------------ | |
| # 4. Publish the release (undraft) | |
| # ------------------------------------------------------------------ | |
| publish-release: | |
| name: Publish release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [create-release, build-binaries, docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false |