Skip to content

Bump actions/checkout from 4.2.2 to 5.0.0 #9309

Bump actions/checkout from 4.2.2 to 5.0.0

Bump actions/checkout from 4.2.2 to 5.0.0 #9309

Workflow file for this run

name: Cargo
on:
workflow_dispatch:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
permissions:
contents: read
pull-requests: write
jobs:
cargo:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-xlarge]
vec: [
{ tls: "quictls", features: "" },
{ tls: "quictls", features: "--features static" },
{ tls: "quictls", features: "--features quictls" },
{ tls: "quictls", features: "--features quictls,static" },
{ tls: "openssl", features: "--features openssl" },
{ tls: "openssl", features: "--features openssl,static" },
{ tls: "quictls", features: "--features overwrite" }
]
runs-on: ${{ matrix.os }}
name: Cargo
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Prepare Machine
run: scripts/prepare-machine.ps1 -Tls ${{ matrix.vec.tls }} -ForBuild -InstallTestCertificates
shell: pwsh
- name: Install Perl
if: runner.os == 'Windows'
uses: shogo82148/actions-setup-perl@5796a908661aa68fc0a5b8f55c6791af2376d72e
with:
perl-version: '5.34'
- name: Install NASM
if: runner.os == 'Windows'
uses: ilammy/setup-nasm@72793074d3c8cdda771dba85f6deafe00623038b
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: 1.88.0
components: rustfmt, clippy
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --all-targets ${{ matrix.vec.features }} -- -D warnings
- name: Cargo build
run: cargo build --all ${{ matrix.vec.features }}
- name: Check all generated files with git
id: bindings_diff
shell: bash
run: |
if git diff --exit-code >> cargo_binding_update.patch; then
echo "diff-found=false" >> $GITHUB_OUTPUT
else
echo "diff-found=true" >> $GITHUB_OUTPUT
{
echo 'diff-content<<@@@'
echo "$(cat cargo_binding_update.patch)"
echo '@@@'
} >> $GITHUB_OUTPUT
echo "$(cat cargo_binding_update.patch)"
fi
- name: Upload the patch file
if: steps.bindings_diff.outputs.diff-found == 'true'
id: upload_patch
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: cargo_binding_update_${{ matrix.os }}
path: cargo_binding_update.patch
- name: Post a comment on PR on mismatch
if: |
!github.event.pull_request.head.repo.fork &&
steps.bindings_diff.outputs.diff-found == 'true'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.number }}
body: |
## ${{ github.workflow }} - ${{ matrix.os }}
The rust bindings need to be updated. Please apply (`git apply`) this [patch](${{ steps.upload_patch.outputs.artifact-url }}):
```diff
${{ steps.bindings_diff.outputs.diff-content }}
```
edit-mode: replace
- name: Fail if generated files are not up to date
if: steps.bindings_diff.outputs.diff-found == 'true'
run: exit 1
- name: Cargo test
run: cargo test --all ${{ matrix.vec.features }}
- name: Cargo Publish (dry run)
run: cargo publish --dry-run --allow-dirty --no-verify
- name: Validate crate size (< 10MB)
# Temporary: skip size check for OpenSSL TLS builds which currently exceed 10MiB.
# We still validate for other TLS configs (e.g., quictls) on ubuntu-latest.
if: matrix.os == 'ubuntu-latest' && matrix.vec.tls != 'openssl'
shell: bash
run: |
set -euo pipefail
# Create the crate package (source tarball)
cargo package --allow-dirty --no-verify
crate_file=$(ls -1 target/package/*.crate | head -n1)
if [[ -z "${crate_file:-}" ]]; then
echo "Error: No .crate file found under target/package" >&2
exit 1
fi
size_bytes=$(stat -c%s "$crate_file")
limit_bytes=$((10 * 1024 * 1024))
echo "Crate: $crate_file"
echo "Size: $size_bytes bytes"
if (( size_bytes > limit_bytes )); then
echo "Crate size exceeds 10MB limit (crates.io max). Please prune package contents." >&2
exit 1
fi
echo "Crate size is within limit."
# Test rust crate with preinstalled msquic lib.
cargo-preinstall:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
features: ["--no-default-features --features find"]
runs-on: ${{ matrix.os }}
name: Cargo-Preinstall
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
with:
toolchain: 1.88.0
components: rustfmt, clippy
- name: Install msquic from apt
run: |
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb;
yes | sudo dpkg -i packages-microsoft-prod.deb;
sudo apt-get update;
sudo apt-get install -y libmsquic;
dpkg -L libmsquic;
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --all-targets ${{ matrix.features }} -- -D warnings
- name: Cargo build
run: cargo build --all ${{ matrix.features }}
- name: Cargo test
run: cargo test --all ${{ matrix.features }}