0.7.5-rc.1 #838
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: | |
- '**' | |
jobs: | |
cargo: | |
name: Cargo test, clippy and doc | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: x86_64-pc-windows-gnu | |
permissions: | |
contents: write | |
security-events: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
target: ${{ matrix.target }} | |
- name: Setup cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Cargo test | |
run: cargo test --target ${{ matrix.target }} | |
- name: Cargo fmt | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: cargo fmt -- --check | |
- name: typos check | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
cargo install typos-cli | |
typos | |
- name: Cargo clippy | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: cargo clippy --all-targets --all-features --message-format=json > clippy_result.json | |
continue-on-error: true | |
- name: Install clippy-sarif sarif-fmt (require cargo) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
cargo install clippy-sarif sarif-fmt | |
cat clippy_result.json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
- name: Upload analysis results to GitHub | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
- name: Cargo doc | |
if: ${{ github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest'}} | |
run: | | |
cargo doc --no-deps --document-private-items | |
echo "<meta http-equiv='refresh' content='0; url=freedit'>" > target/doc/index.html | |
rm target/doc/.lock | |
- name: Upload artifact | |
if: ${{ github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest'}} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'target/doc' | |
Deploy: | |
needs: cargo | |
name: Deploy to GitHub Pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: 'github-pages' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |