Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run book and tests workflows only on relevant PRs #241

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions .github/workflows/deploy-book.yml → .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
name: Deploy book
name: Book
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:
branches:
- main
paths:
- .github/workflows/book.yml
- book/**

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: beta
- uses: Swatinem/rust-cache@v2
- name: Install mdbook and mdbook-linkcheck
uses: taiki-e/install-action@v2
with:
tool: mdbook, mdbook-linkcheck
- name: Build mdbook
run: |
mdbook build book
- name: Archive book output
uses: actions/upload-artifact@v3
if: always()
with:
name: book
path: book/book

deploy:
if: github.repository == 'sourcefrog/cargo-mutants'
if:
github.repository == 'sourcefrog/cargo-mutants' && github.ref_name ==
'main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency: # Allow one concurrent deployment
group: "pages"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
30 changes: 8 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ on:
branches:
- main
pull_request:
paths:
- ".cargo/**"
- ".github/workflows/tests.yml"
- "Cargo.*"
- "mutants_attrs/**"
- "src/**"
- "testdata/**"
- "tests/**"

# see https://matklad.github.io/2021/09/04/fast-rust-builds.html
env:
Expand Down Expand Up @@ -145,25 +153,3 @@ jobs:
with:
name: mutants.out
path: mutants.out

book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: beta
- uses: Swatinem/rust-cache@v2
- name: Install mdbook and mdbook-linkcheck
uses: taiki-e/install-action@v2
with:
tool: mdbook, mdbook-linkcheck
- name: Build mdbook
run: |
mdbook build book
- name: Archive book output
uses: actions/upload-artifact@v3
if: always()
with:
name: book
path: book/book