Skip to content

Commit d3d9a36

Browse files
committed
Added check-public-api.yaml workflow
1 parent e32ecdf commit d3d9a36

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check public API
2+
3+
env:
4+
RUST_BACKTRACE: 1
5+
6+
on:
7+
push:
8+
branches:
9+
- 'master'
10+
tags:
11+
# this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
12+
- '[0-9]+.[0-9]+.[0-9]+*'
13+
workflow_dispatch:
14+
inputs:
15+
release:
16+
required: true
17+
description: 'Check public API for changes'
18+
jobs:
19+
setup:
20+
name: Set up
21+
runs-on: ubuntu-latest
22+
outputs:
23+
VERSION: ${{ steps.setup.outputs.VERSION }}
24+
SHOULD_CHECK_API: ${{ steps.setup.outputs.SHOULD_CHECK_API }}
25+
steps:
26+
27+
- name: Set up env vars
28+
id: setup
29+
shell: bash
30+
run: |
31+
VERSION=${GITHUB_REF/refs\/tags\//}
32+
echo ::set-output name=VERSION::${VERSION}
33+
SHOULD_CHECK_API=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true)
34+
echo ::set-output name=SHOULD_CHECK_API::${SHOULD_CHECK_API}
35+
echo $VERSION
36+
echo $SHOULD_CHECK_API
37+
38+
- uses: actions/checkout@v2
39+
- name: Install latest nightly
40+
uses: actions-rs/toolchain@v1
41+
with:
42+
toolchain: nightly
43+
profile: minimal
44+
override: true
45+
46+
- name: Generate API change report
47+
run: |
48+
cargo install cargo-public-api
49+
cargo install ripgrep
50+
LATEST_VERSION=$(cargo search wasmer | rg --only-matching --replace '$1' 'wasmer = "(.*)"')
51+
cargo public-api --manifest-path=lib/api/Cargo.toml --diff-git-checkouts $LATEST_VERSION master > diff.txt
52+
53+
- name: Archive change report
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: api-diff-report
57+
path: |
58+
diff.txt
59+
60+

0 commit comments

Comments
 (0)