Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

chore: release v0.2.10 #573

chore: release v0.2.10

chore: release v0.2.10 #573

Workflow file for this run

name: "🤖 Check: 'gdpack'"
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 4
outputs:
has_change: "${{ steps.check-non-source.outputs.any_modified == 'true' || steps.check-source.outputs.any_modified == 'true' }}"
has_source_change: "${{ steps.check-source.outputs.any_modified == 'true' }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for any non-source code changes
id: check-non-source
uses: tj-actions/changed-files@v44
with:
files: |
.github/actions/**
.github/workflows/**
Cargo.toml
Cargo.lock
- name: Check for any source code changes
id: check-source
uses: tj-actions/changed-files@v44
with:
files: |
src/**/*.rs
build:
needs: ["changes"]
if: needs.changes.outputs.has_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-rust"
id: setup-rust
with:
version-file: Cargo.toml
profile: minimal
- uses: "./.github/actions/cargo-build"
with:
profile: release
format:
needs: ["changes"]
if: |
needs.changes.outputs.has_source_change == 'true' &&
github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
with:
# Checkout the "head_ref" (i.e. PR branch HEAD) in case a commit is
# later needed. See https://github.com/stefanzweifel/git-auto-commit-action
# for more details.
ref: ${{ github.head_ref }}
# Use a PAT so that GitHub Actions will trigger on the resulting commit.
token: ${{ secrets.ACTIONS_BOT }}
- uses: "./.github/actions/setup-rust"
id: setup-rust
with:
version-file: Cargo.toml
profile: minimal
components: rustfmt
- name: Check Rust source formatting
id: format
continue-on-error: true
run: cargo fmt --check
- name: Fix formatting of source code
if: steps.format.outcome == 'failure'
run: |
cargo fmt
# See https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add --all '*.rs'
git commit -m "chore: fix formatting (on behalf of '${{ github.triggering_actor }}')"
git push
- name: Terminate CI run early
if: steps.format.outcome == 'failure'
run: exit 1
lint:
needs: ["changes", "build", "format"]
if: needs.changes.outputs.has_source_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-rust"
id: setup-rust
with:
version-file: Cargo.toml
profile: minimal
components: clippy
- uses: "./.github/actions/cargo-build"
with:
profile: release
- name: Lint 'rust' source
run: |
cargo clippy \
--all-features \
--all-targets \
--no-deps \
-- \
--deny=warnings
test:
needs: ["changes", "build"]
if: needs.changes.outputs.has_change == 'true'
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-rust"
id: setup-rust
with:
version-file: Cargo.toml
profile: minimal
- uses: "./.github/actions/cargo-build"
with:
profile: release
# See https://github.com/taiki-e/cargo-llvm-cov?tab=readme-ov-file#installation.
- name: Install 'cargo-llvm-cov'
if: needs.changes.outputs.has_source_change == 'true'
run: cargo install cargo-llvm-cov --locked
- name: Test source code (with coverage)
if: needs.changes.outputs.has_source_change == 'true'
run: |
cargo llvm-cov \
--frozen \
--release \
--target=x86_64-unknown-linux-gnu \
--all-features \
--all-targets \
--remap-path-prefix \
--codecov \
--output-path codecov.json
- name: Test source code
if: needs.changes.outputs.has_source_change != 'true'
run: |
cargo test \
--frozen \
--release \
--target=x86_64-unknown-linux-gnu \
--all-features \
--all-targets
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
if: needs.changes.outputs.has_source_change == 'true'
with:
fail_ci_if_error: true
files: codecov.json
token: ${{ secrets.CODECOV_TOKEN }}
# Used to ensure all branch protection requirements are met. This is a workaround until
# https://github.com/github-community/community/discussions/4324 is addressed.
branch_protection:
needs: ["build", "format", "lint", "test"]
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Verify 'build' status
if: |
always() &&
needs.build.result == 'failure' ||
needs.build.result == 'cancelled'
run: exit 1
- name: Verify 'format' status
if: |
always() &&
needs.format.result == 'failure' ||
needs.format.result == 'cancelled'
run: exit 1
- name: Verify 'lint' status
if: |
always() &&
needs.lint.result == 'failure' ||
needs.lint.result == 'cancelled'
run: exit 1
- name: Verify 'test' status
if: |
always() &&
needs.test.result == 'failure' ||
needs.test.result == 'cancelled'
run: exit 1