-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate example GitHub workflows (#269)
Split out example workflow yaml into `examples/workflow`. Run the actionlint validator on all workflows, and fix some nits. Fixes #266
- Loading branch information
Showing
7 changed files
with
126 additions
and
82 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: actionlint | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- ".github/workflows/*.yml" | ||
- "examples/workflows/*.yml" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- ".github/workflows/*.yml" | ||
- "examples/workflows/*.yml" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
action-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check workflow files | ||
shell: bash | ||
run: | | ||
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | ||
# shellcheck disable=SC2046 | ||
./actionlint -color $(find .github/workflows examples/workflows -name '*.yml' -type f ! -name release.yml -print) |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Example of how to configure a GitHub Actions workflow to run `cargo mutants` | ||
# on every push to main and every pull request that changes the code. | ||
|
||
# You could run this standalone or merge it into a workflow that runs other tests. | ||
|
||
name: cargo-mutants | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
# Only test PR if it changes something that's likely to affect the results, because | ||
# mutant tests can take a long time. Adjust these paths to suit your project. | ||
paths: | ||
- ".cargo/mutants.toml" | ||
- ".github/workflows/tests.yml" | ||
- "Cargo.*" | ||
- "src/**" | ||
- "testdata/**" | ||
- "tests/**" | ||
|
||
jobs: | ||
cargo-mutants: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-mutants | ||
- run: cargo mutants -vV --in-place | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: mutants-out | ||
path: mutants.out |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# An example of how to run cargo-mutants on only the sections of code that have changed in a pull request, | ||
# using the `--in-diff` feature of cargo-mutants. | ||
# | ||
# This can give much faster feedback on pull requests, but can miss some problems that | ||
# would be found by running mutants on the whole codebase. | ||
|
||
name: Tests | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
incremental-mutants: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Relative diff | ||
run: | | ||
git branch -av | ||
git diff origin/${{ github.base_ref }}.. | tee git.diff | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: taiki-e/install-action@v2 | ||
name: Install cargo-mutants using install-action | ||
with: | ||
tool: cargo-mutants | ||
- name: Mutants | ||
run: | | ||
cargo mutants --no-shuffle -vV --in-diff git.diff | ||
- name: Archive mutants.out | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: mutants-incremental.out | ||
path: mutants.out |