1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Public API Check
on:
pull_request:
branches:
- master
# 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:
# Full git history needed
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Install nightly
- uses: actions-rs/toolchain@v1
with:
# We need nightly for cargo-public-api to get the API output.
toolchain: nightly
profile: minimal
# It is not necessary to use nightly as default (which is used to install cargo-public-api and compile our code).
# However, our current toolchain is 1.59.0, and cargo-public-api requires 1.60 at least. To make it simple,
# we just use the latest nightly toolchain.
override: true
- run: cargo --version
# Install cargo-public-api
- name: Install cargo-public-api
run: cargo install cargo-public-api
- name: API Diff
run: cargo public-api --diff-git-checkouts origin/${GITHUB_BASE_REF} ${{ github.event.pull_request.head.sha }} --deny=all