-
Notifications
You must be signed in to change notification settings - Fork 15
62 lines (58 loc) · 1.94 KB
/
mmaps_pr.yaml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: compare mmaps
on:
pull_request_target:
jobs:
compare:
name: Compare mmaps
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
path: main
- name: Checkout pull request
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.number }}/head
path: pr
- name: Checkout mmaps
uses: actions/checkout@v4
with:
repository: gd32-rust/gd32-rs-mmaps
ssh-key: ${{ secrets.MMAPS_KEY }}
path: mmaps
- name: Install Python dependencies
run: |
pip3 install --user setuptools wheel
pip3 install --user svdtools
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH
- name: Build and publish
run: |
# Grab commit ID from checked out PR
cd pr
COMMIT=$(git rev-parse --short HEAD)
BRANCH=pr-${{ github.event.number }}-$COMMIT
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
# Use the PR's YAML files to rebuild mmaps
cd ../main
rm -rf devices peripherals
mv ../pr/devices ../pr/peripherals .
make -j2 mmaps
# Use the new mmaps to make a commit in the mmaps repo
mv mmaps/* ../mmaps/
cd ../mmaps
git checkout -b $BRANCH
git add .
git config user.name "gd32-rs builder"
git config user.email "[email protected]"
git commit --allow-empty -m "gd32-rs PR #${{ github.event.number }} $COMMIT"
git push origin $BRANCH
- name: Comment
uses: mshick/add-pr-comment@v2
with:
message: |
[Memory map comparison](https://github.com/gd32-rust/gd32-rs-mmaps/compare/${{ env.BRANCH }})
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]'