File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # This workflow generates source code that will be committed to the repository.
2+ # It should NEVER be triggered by untrusted sources.
13name : Generate golang constants
24
35on :
Original file line number Diff line number Diff line change 11name : Run unit tests
22
33on :
4- workflow_run :
5- workflows :
6- - " Generate golang constants"
7- branches :
8- - main
9- types :
10- - completed # ensure the generation of constants is finished before running tests
4+ push :
5+ branches : [main]
6+ pull_request :
117 workflow_dispatch :
128 inputs :
139 unicorn_ref :
3430 with :
3531 go-version : stable
3632
33+ - name : Install stringer tool
34+ run : |
35+ go install golang.org/x/tools/cmd/stringer@latest
36+
3737 - name : Resolve unicorn ref
3838 id : resolve
3939 env :
@@ -42,27 +42,39 @@ jobs:
4242 OVERRIDE="${{ github.event.inputs.unicorn_ref }}"
4343 if [ -n "$OVERRIDE" ]; then
4444 echo "ref=$OVERRIDE" >> $GITHUB_OUTPUT
45-
4645 elif [ "${{ matrix.unicorn_ref }}" = "latest_tag" ]; then
4746 TAG=$(curl -sf https://api.github.com/repos/unicorn-engine/unicorn/releases/latest | jq -r '.tag_name')
4847 echo "ref=$TAG" >> $GITHUB_OUTPUT
49-
5048 else
5149 echo "ref=dev" >> $GITHUB_OUTPUT
5250 fi
5351
54- - name : Clone unicorn
52+ - name : Clone unicorn-engine
5553 run : |
5654 git clone \
5755 --depth 1 \
5856 --branch ${{ steps.resolve.outputs.ref }} \
5957 https://github.com/unicorn-engine/unicorn \
60- unicorn
58+ build/unicorn
59+
60+ - name : Generate files
61+ run : |
62+ cd build
63+ python3 ./const_generator.py -i ./unicorn/include/unicorn -o ..
64+
65+ - name : Generate Go related files
66+ run : |
67+ stringer -linecomment -type GoUcError -output ./unicorn_go_const_stringers.go ./unicorn_go_const.go
68+
69+ - name : Format go files
70+ run : |
71+ go fmt .
6172
6273 - name : Build & install unicorn
6374 run : |
64- cd unicorn
65- mkdir build && cd build
75+ cd build/unicorn
76+ mkdir build
77+ cd build
6678 cmake .. -DCMAKE_BUILD_TYPE=Release
6779 make -j$(nproc)
6880 sudo make install
You can’t perform that action at this time.
0 commit comments