Skip to content

Testing the history canary feature (don't merge) #1494

Testing the history canary feature (don't merge)

Testing the history canary feature (don't merge) #1494

Workflow file for this run

name: Public API Check
on:
pull_request:
branches:
- master
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# The workflow may fail if we change the public API in a pull request.
# We allow fail on this action. But we should manually check if the changes are reasonable when we see a failed action.
# It would be good if the workflow returns a neutral status when we find API changes. But it is currently not
# possible with Github actions.
jobs:
check-public-api-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout mmtk-core
uses: actions/checkout@v4
with:
# Full git history needed
fetch-depth: 0
# cargo-public-api needs a nightly toolchain installed in order to work.
# It does not have to be the active toolchain.
- name: Install nightly Rust toolchain
run: rustup toolchain install nightly
# Show the Rust toolchain we are actually using
- run: rustup show
- run: cargo --version
- run: cargo +nightly --version
- name: Install cargo-public-api
run: cargo +nightly install cargo-public-api
- name: API Diff
run: cargo +nightly public-api diff origin/${GITHUB_BASE_REF}..${{ github.event.pull_request.head.sha }} --deny=all
check-api-migration-update:
needs: check-public-api-changes
runs-on: ubuntu-latest
if: ${{ always() && needs.check-public-api-changes.result == 'failure'}}
env:
MIGRATION_GUIDE_PATH: 'docs/userguide/src/migration/**'
steps:
# Check if migration guide is updated.
- name: Get the update status for the migration guide.
uses: tj-actions/changed-files@v44
id: migration-guide-status
with:
files: ${{ env.MIGRATION_GUIDE_PATH }}
# If the api check failed but the migration is not updated, we fail here
- name: Report if the migration guide is not updated.
if: ${{ steps.migration-guide-status.outputs.any_changed == 'false' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Public API is changed, but the migration guide (${{ env.MIGRATION_GUIDE_PATH }}) is not updated. If the bindings need to be updated for the API change, the migration guide needs to be updated as well.')