-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (64 loc) · 2 KB
/
ci-codegen.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: ci-codegen
on:
push:
branches: ["main"]
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
codegen-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- name: Install protoc
run: sudo apt-get install protobuf-compiler
- name: Install
working-directory: ${{github.workspace}}/codegen
run: |
set -e
poetry install
- name: Run Python Codegen
working-directory: ${{github.workspace}}/codegen
run: poetry run python codegen
- name: Run CLI Help Dump
working-directory: ${{github.workspace}}/docs/
run: bash ./update_cli_help.bash
- name: Check for diff
id: check-codegen-diff
working-directory: ${{github.workspace}}
run: |
set +e
git diff --exit-code >> ~/codegen_changes.patch
exitCode=$?
set -e
if [ $exitCode -eq 0 ]; then
echo -e "OK"
else
# Run a git diff to print the differences
echo -e "::group::Format Difference"
git diff --color=always
echo -e "::endgroup::"
echo -e "List of files with differences:"
echo -e $(git diff --name-only)
echo -e ""
fi
exit $exitCode
- name: Upload Diff
if: failure() && ( steps.check-codegen-diff.outcome == 'failure' )
id: upload-codegen-patch
uses: actions/upload-artifact@v4
with:
name: code
path: ~/codegen_changes.patch
retention-days: 2