diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-12 11:08:34 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-08 07:56:17 +0200 |
commit | b669977eb727fddd9eabdfb88c9bc0d9eaf94ff2 (patch) | |
tree | 2a7eceb53f0553a89da8e781493fbd4397d06c67 | |
parent | fd178124731a39aac6384be65218a33e4e137480 (diff) |
Add apidiff actiongh-action/apidiff
This patch adds an action that checks crates for changes in their API
and comments with the found changes.
Until support for "checks" is merged in cargo-public-api, which we then
could use to only post a comment to the PR if there is a change in the
API, and simply post "No API changes" or something like that if there
are none, we might experience a bit much output.
Also, there's no way (yet) in cargo-public-api to lint multiple crates
at once, so we must resort to a matrix run here.
If such a feature is implemented in cargo-public-api, we should use it
of course.
This initial patch adds all crates in the matrix, but we might discuss
whether this is necessary for all crates.
We might only run this for crates that are actually exposed to users of
the project.
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | .github/workflows/pull-request-checks.yml | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 49080505..bd8f7e89 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -340,3 +340,65 @@ jobs: # uses: codecov/codecov-action@v1 # with: # token: ${{secrets.CODECOV_TOKEN}} + + apidiff: + name: apidiff + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + strategy: + matrix: + manifest_dir: + - crates/common/batcher + - crates/common/certificate + - crates/common/clock + - crates/common/download + - crates/common/flockfile + - crates/common/json_writer + - crates/common/logged_command + - crates/common/mqtt_channel + - crates/common/tedge_config + - crates/common/tedge_users + - crates/common/tedge_utils + - crates/core/agent_interface + - crates/core/c8y_api + - crates/core/c8y_smartrest + - crates/core/c8y_translator + - crates/core/plugin_sm + - crates/core/tedge + - crates/core/tedge_agent + - crates/core/tedge_mapper + - crates/core/tedge_watchdog + - crates/core/thin_edge_json + - lib/download + - lib/plugin_sm + - lib/tedge_config + - plugins/c8y_configuration_plugin + - plugins/c8y_log_plugin + - plugins/tedge_apama_plugin + - plugins/tedge_apt_plugin + - plugins/tedge_docker-compose_plugin + - plugins/tedge_docker_plugin + - plugins/tedge_dummy_plugin + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - uses: swatinem/rust-cache@v1 + - run: cargo install --locked cargo-public-api + - run: echo -e "### API changes\n\n" >> apidiff.txt + - run: echo -e "<details><summary>API diff in ${{ matrix.manifest_dir }}</summary>\n" >> apidiff.txt + - run: echo "\`\`\`" >> apidiff.txt + - run: cargo public-api --manifest-path ${{ matrix.manifest_dir }}/Cargo.toml --diff-git-checkouts $(git merge-base origin/main $GITHUB_SHA) $GITHUB_SHA |& tee -a apidiff.txt + - run: echo "\`\`\`" >> apidiff.txt + - run: echo -e "</details>\n" >> apidiff.txt + - name: "Post to PR" + uses: machine-learning-apps/pr-comment@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: apidiff.txt + |