Merge pull request #465 from danieleades/msrv #1988
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 2 * * *' | |
env: | |
clippy_rust_version: '1.82' | |
jobs: | |
test: | |
strategy: | |
matrix: | |
rust: ["stable", "beta", "nightly"] | |
os: [ubuntu-latest, macos-latest] | |
name: Cargo test | |
runs-on: ${{ matrix.os }} | |
if: github.repository == 'graphql-rust/graphql-client' | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Execute cargo test | |
run: cargo test --all --tests --examples | |
wasm_build: | |
name: Cargo build for wasm | |
runs-on: ubuntu-latest | |
if: github.repository == 'graphql-rust/graphql-client' | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: wasm32-unknown-unknown | |
- name: Execute cargo build | |
run: | | |
cargo build --manifest-path=./graphql_client/Cargo.toml --features="reqwest" --target wasm32-unknown-unknown | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo fmt --all -- --check | |
lint: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.clippy_rust_version }} | |
components: clippy | |
- run: cargo clippy --all --all-targets --all-features -- -D warnings | |
msrv: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Get MSRV from Cargo.toml | |
run: | | |
MSRV=$(grep 'rust-version' Cargo.toml | sed 's/.*= *"\(.*\)".*/\1/') | |
echo "MSRV=$MSRV" >> $GITHUB_ENV | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MSRV }} | |
- uses: taiki-e/install-action@cargo-no-dev-deps | |
- run: cargo no-dev-deps check -p graphql_client | |
# Automatically merge if it's a Dependabot PR that passes the build | |
dependabot: | |
needs: [test, wasm_build, lint, msrv] | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
if: github.actor == 'dependabot[bot]' | |
steps: | |
- name: Enable auto-merge for Dependabot PRs | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{github.event.pull_request.html_url}} | |
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |