docs: update README with new build table #75
Workflow file for this run
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
# SPDX-FileCopyrightText: 2023 - 2024 Ali Sajid Imami | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# SPDX-License-Identifier: MIT | |
--- | |
name: Continuous integration | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
workflow_dispatch: | |
concurrency: | |
group: ${{github.event.ref}} | |
cancel-in-progress: true | |
env: | |
GIST_KEY: 68f75dde24f65f2a9333a4ca3d38c82b # pragma: allowlist secret | |
RUST_BACKTRACE: 1 | |
MINIMUM_WAIT: 3 | |
MAXIMUM_WAIT: 10 | |
jobs: | |
check_changed_dirs: | |
runs-on: ubuntu-latest | |
outputs: | |
source_changed: ${{steps.changed_dirs.outputs.source}} | |
book_changed: ${{steps.changed_dirs.outputs.book}} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Check changed directories | |
id: changed_dirs | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
source: | |
- "src/**/*" | |
- "tests/**/*" | |
- "examples/**/*" | |
- "Cargo.toml" | |
- "Cargo.lock" | |
book: | |
- "guide/src/*.md" | |
- "guide/book.toml" | |
ci: | |
runs-on: ${{matrix.os}}-latest | |
needs: [check_changed_dirs] | |
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' | |
outputs: | |
result: ${{steps.result.outputs.result}} | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
- 1.70.0 # MSRV | |
os: | |
- windows | |
- ubuntu | |
- macos | |
include: | |
- os: windows | |
logo: windows | |
- os: ubuntu | |
logo: ubuntu | |
- os: macos | |
logo: apple | |
- rust: 1.70.0 # MSRV | |
label: msrv | |
- rust: stable | |
label: stable | |
- rust: beta | |
label: beta | |
- rust: nightly | |
label: nightly | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install Rust | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{matrix.rust}} | |
components: rustfmt, clippy | |
- name: Install nightly Rust | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: rustfmt, clippy | |
- name: Cache dependencies | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
- name: Cargo Build | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
run: cargo build --verbose | |
- name: Cargo Test | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
run: cargo test | |
- name: Cargo Format | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
run: cargo +nightly fmt --all -- --check | |
- name: Cargo Lint | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
run: cargo clippy -- -D warnings | |
- name: Wait before badge creation | |
if: ${{ needs.check_changed_dirs.outputs.source_changed == 'true' }} | |
uses: AliSajid/random-wait-action@e64e2d7024f9adae6633b7599abe5e766a4a75a3 # v2.3.1 | |
with: | |
minimum: ${{env.MINIMUM_WAIT}} | |
maximum: ${{env.MAXIMUM_WAIT}} | |
- name: Create Awesome Badge - Success | |
uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0 | |
if: success() | |
with: | |
auth: ${{secrets.GIST_SECRET}} | |
gistID: ${{env.GIST_KEY}} | |
filename: ${{matrix.os}}-${{matrix.label}}.json | |
label: Build | |
namedLogo: ${{matrix.logo}} | |
message: Succeeded | |
color: green | |
- name: Create Awesome Badge - Failure | |
uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0 | |
if: failure() | |
with: | |
auth: ${{secrets.GIST_SECRET}} | |
gistID: ${{env.GIST_KEY}} | |
filename: ${{matrix.os}}-${{matrix.label}}.json | |
namedLogo: ${{matrix.logo}} | |
label: Build | |
message: Failed | |
isError: true | |
- name: Set Result | |
if: always() | |
id: result | |
run: echo "result=${{job.status}}" >> "$GITHUB_OUTPUT" | |
generate_code_coverage: | |
uses: ./.github/workflows/code_coverage.yaml | |
needs: [ci, check_changed_dirs] | |
if: ${{needs.check_changed_dirs.outputs.source_changed == 'true'}} | |
secrets: inherit # pragma: allowlist secret | |
get-next-version: | |
uses: ./.github/workflows/get_next_version.yaml | |
needs: [ci, check_changed_dirs] | |
if: ${{needs.ci.outputs.result == 'success'}} | |
secrets: inherit # pragma: allowlist secret | |
semantic-release: | |
needs: [ci, get-next-version] | |
if: ${{needs.get-next-version.outputs.new-release-published == 'true'}} | |
uses: ./.github/workflows/release.yaml | |
secrets: inherit # pragma: allowlist secret |