From b92d4bcaceb21c901944191d3bf1c7fd63a285cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Tue, 5 Jul 2022 16:50:05 +0200 Subject: [PATCH] Add check-public-api CI workflow to track changes in the public API The new check-public-api workflow checks outputs a diff as an artifact between the current master and the latest deployed version of wasmer on crates.io Fixes #2984 Fetch entire history of git repo to generate public API diff Only run diff-API workflow when releasing new versions Trigger diff-api workflow only manually or on tags --- .github/workflows/check-public-api.yaml | 47 +++++++++++++++++++++++++ CHANGELOG.md | 1 + 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/check-public-api.yaml diff --git a/.github/workflows/check-public-api.yaml b/.github/workflows/check-public-api.yaml new file mode 100644 index 00000000000..fe2ff30009a --- /dev/null +++ b/.github/workflows/check-public-api.yaml @@ -0,0 +1,47 @@ +name: Check public API + +env: + RUST_BACKTRACE: 1 +on: + workflow_dispatch: + inputs: + compareMasterWithVersion: + required: false + description: 'Version to compare with (i.e. "1.0.2")' +jobs: + setup: + name: Set up + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.setup.outputs.VERSION }} + SHOULD_CHECK_API: ${{ steps.setup.outputs.SHOULD_CHECK_API }} + steps: + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + + - name: Generate API change report + shell: bash + run: | + cargo install cargo-public-api + CARGO_LATEST_VERSION = git tag --list | tail -n 1 + LATEST_VERSION=${INPUT_COMPAREMASTERWITHVERSION:=$CARGO_LATEST_VERSION} + cargo public-api --manifest-path=lib/api/Cargo.toml --diff-git-checkouts $LATEST_VERSION master > diff.txt + + - name: Archive change report + uses: actions/upload-artifact@v3 + with: + name: api-diff-report + path: | + diff.txt + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ab9fe35c1e..645ba388c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C ### Changed - [#3017](https://github.com/wasmerio/wasmer/pull/3017) Fix typo in README.md +- [#3008](https://github.com/wasmerio/wasmer/pull/3008) Add a new CI check that uses cargo public-api to track changes in the API between master and the last deployed version on crates.io - [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API - [#2999](https://github.com/wasmerio/wasmer/pull/2999) Allow `--invoke` CLI option for Emscripten files without a `main` function - [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine