Skip to content

try to fix issues where cargo test failures on Windows runners don't fail the CI job #635

try to fix issues where cargo test failures on Windows runners don't fail the CI job

try to fix issues where cargo test failures on Windows runners don't fail the CI job #635

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Validate Pull Request
on:
pull_request:
branches: [main, "release/**"]
merge_group:
# Cancels old running job if a new one is triggered (e.g. by a push onto the same branch).
# This will cancel dependent jobs as well, such as dep_rust and dep_fuzzing
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
jobs:
docs-and-common-deps-pr:
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.docs-only.outputs.result }}
steps:
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
docs:
- '**/*.md'
- '**/*.txt'
all:
- '**/*'
common_deps:
- '**/src/hyperlight_guest/Cargo.toml'
- '**/src/hyperlight_common/Cargo.toml'
- uses: actions/github-script@v7
id: docs-only
with:
script: |
let docs_file_count = ${{steps.changes.outputs.docs_count}};
let all_file_count = ${{steps.changes.outputs.all_count}};
return all_file_count === docs_file_count;
result-encoding: string
# Check to see if this a dependabot PR and if it updates either the common or guest Cargo.toml files
# if it does we need to try and generate a new Cargo.lock file as the PR validation checks that these are up to date
- name: checkout
if: ${{ github.actor == 'dependabot[bot]' && steps.changes.outputs.common_deps_count > 0 }}
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Update Cargo.lock for dependabot changes
if: ${{ github.actor == 'dependabot[bot]' && steps.changes.outputs.common_deps_count > 0 }}
run: |
cargo update --manifest-path src/tests/rust_guests/simpleguest/Cargo.toml
cargo update --manifest-path src/tests/rust_guests/callbackguest/Cargo.toml
if [ -n "$(git status --porcelain src/tests/rust_guests/simpleguest/Cargo.lock src/tests/rust_guests/callbackguest/Cargo.lock)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add src/tests/rust_guests/simpleguest/Cargo.lock
git add src/tests/rust_guests/callbackguest/Cargo.lock
git commit -m "Update Cargo.lock files for dependabot changes"
git push
fi
rust:
needs:
- docs-and-common-deps-pr
uses: ./.github/workflows/dep_rust.yml
secrets: inherit
with:
docs_only: ${{needs.docs-and-common-deps-pr.outputs.docs-only}}
fuzzing:
needs:
- docs-and-common-deps-pr
uses: ./.github/workflows/dep_fuzzing.yml
with:
max_total_time: 300 # 5 minutes in seconds
docs_only: ${{needs.docs-and-common-deps-pr.outputs.docs-only}}
secrets: inherit
spelling:
name: spell check with typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@master