diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 620f9acc..faa8a279 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -93,6 +93,8 @@ jobs:
permissions:
"code-quality": "write"
"contents": "read"
+ "id-token": "write"
+ "pages": "write"
# Build and packages all the platform-specific things
build-local-artifacts:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b75e1e27..f2564aee 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -19,9 +19,6 @@ concurrency:
jobs:
nextest:
runs-on: ${{matrix.os}}
- permissions:
- contents: read
- code-quality: write
strategy:
matrix:
build: [linux, macos, windows]
@@ -35,6 +32,9 @@ jobs:
- build: windows
os: windows-latest
target: x86_64-pc-windows-msvc
+ permissions:
+ contents: read
+ code-quality: write
steps:
- name: "[linux] Install dependencies"
run: |
@@ -50,6 +50,7 @@ jobs:
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
+
- name: Checkout repository
uses: actions/checkout@v6
with:
@@ -70,11 +71,24 @@ jobs:
env-vars: "____"
cache-on-failure: "true"
cache-all-crates: "true"
+
- name: Run doctests
run: cargo test --doc
- - name: Run tests
+ - name: "[linux] Run tests with coverage"
+ if: runner.os == 'Linux'
# Do not use `--all-targets` to avoid running benches
- run: cargo llvm-cov nextest --release --profile ci --bins --lib --examples --tests --cobertura --output-path coverage.xml --failure-mode all
+ run: |
+ cargo llvm-cov nextest --release --profile ci --bins --lib --examples --tests --no-report
+ cargo llvm-cov report --release --cobertura --output-path coverage.xml
+ cargo llvm-cov report --release --html
+ echo "COVERAGE_PERCENT=$(cargo llvm-cov report --release | tail -n1 | awk '{ print $4 }')" | tee --append $GITHUB_ENV
+ env:
+ LC_ALL: en_US.UTF-8
+ TERM: xterm-256color
+ - name: "[macos/windows] Run tests"
+ if: runner.os != 'Linux'
+ # Do not use `--all-targets` to avoid running benches
+ run: cargo nextest run --release --profile ci --bins --lib --examples --tests
env:
LC_ALL: en_US.UTF-8
TERM: xterm-256color
@@ -93,17 +107,58 @@ jobs:
fi
done
shell: bash
- - name: Upload coverage report
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- # fail-on-error: false
+ - name: "[linux] Upload coverage report"
+ if: runner.os == 'Linux' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
+ continue-on-error: true
uses: actions/upload-code-coverage@v1
with:
file: coverage.xml
language: Rust
label: ${{ runner.os }}
+ - name: "[linux] Generate coverage badge"
+ if: &if-linux-master runner.os == 'Linux' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
+ uses: emibcn/badge-action@v2.0.2
+ with:
+ label: 'Coverage'
+ status: ${{ env.COVERAGE_PERCENT }}
+ color: 'blue'
+ path: 'target/llvm-cov/html/coverage.svg'
+ - name: "[linux] Upload default branch results to gh pages"
+ if: *if-linux-master
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: target/llvm-cov/html
+
+ deploy-coverage-page:
+ needs: nextest
+ permissions:
+ pages: write
+ id-token: write
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: "[linux] Deploy gh pages"
+ id: deployment
+ if: *if-linux-master
+ uses: actions/deploy-pages@v4
clippy:
- runs-on: ubuntu-latest
+ runs-on: ${{matrix.os}}
+ strategy:
+ matrix:
+ build: [linux, macos, windows]
+ include:
+ - build: linux
+ os: ubuntu-latest
+ target: x86_64-unknown-linux-musl
+ - build: macos
+ os: macos-latest
+ target: x86_64-apple-darwin
+ - build: windows
+ os: windows-latest
+ target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v6
@@ -117,7 +172,20 @@ jobs:
run: cargo clippy
rustfmt:
- runs-on: ubuntu-latest
+ runs-on: ${{matrix.os}}
+ strategy:
+ matrix:
+ build: [linux, macos, windows]
+ include:
+ - build: linux
+ os: ubuntu-latest
+ target: x86_64-unknown-linux-musl
+ - build: macos
+ os: macos-latest
+ target: x86_64-apple-darwin
+ - build: windows
+ os: windows-latest
+ target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v6
@@ -126,6 +194,33 @@ jobs:
run: |
cargo fmt --all -- --check
+ build-no-default-features:
+ runs-on: ${{matrix.os}}
+ strategy:
+ matrix:
+ build: [linux, macos, windows]
+ include:
+ - build: linux
+ os: ubuntu-latest
+ target: x86_64-unknown-linux-musl
+ - build: macos
+ os: macos-latest
+ target: x86_64-apple-darwin
+ - build: windows
+ os: windows-latest
+ target: x86_64-pc-windows-msvc
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+ - run: rustup toolchain install
+ - name: Cache
+ uses: Swatinem/rust-cache@v2
+ with: *cache-with
+ - name: Build without any feature
+ run: |
+ cargo build --no-default-features
+
+
msrv:
runs-on: ubuntu-latest
steps:
@@ -139,16 +234,3 @@ jobs:
tool: cargo-msrv@0.19
- name: MSRV Verify
run: cargo msrv verify
-
- build-no-default-features:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout repository
- uses: actions/checkout@v6
- - run: rustup toolchain install
- - name: Cache
- uses: Swatinem/rust-cache@v2
- with: *cache-with
- - name: Build without any feature
- run: |
- cargo build --no-default-features
diff --git a/.gitignore b/.gitignore
index 82312be7..e66c1657 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,4 +36,5 @@ __pycache__/
.envrc.local
/public
-.codex
\ No newline at end of file
+.codex
+/coverage.xml
diff --git a/README.md b/README.md
index 5e41116a..90c9884c 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,9 @@
+
+
+
diff --git a/dist-workspace.toml b/dist-workspace.toml
index a7f4c389..f004891d 100644
--- a/dist-workspace.toml
+++ b/dist-workspace.toml
@@ -27,3 +27,5 @@ publish-prereleases = true
[dist.github-custom-job-permissions.test]
code-quality = "write"
contents = "read"
+pages = "write"
+id-token = "write"