forked from flipperdevices/video-game-module
-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (74 loc) · 2.66 KB
/
build.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
79
80
81
82
83
84
85
86
87
name: build
on:
push:
branches:
- main
tags:
- '*'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Wipe workspace'
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v4
with:
submodules: false
ref: ${{ github.event.pull_request.head.sha }}
- name: 'Checkout submodules'
run: git submodule update --init --recursive --depth 1 --jobs "$(getconf _NPROCESSORS_ONLN)";
- name: 'Setup python'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: 'Get commit details'
id: names
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
else
TYPE="other"
fi
python3 scripts/get_env.py \
"--event_file=${{ github.event_path }}" \
"--type=$TYPE" \
"--github_auth_token=${{ secrets.GITHUB_TOKEN }}";
echo "event_type=$TYPE" >> $GITHUB_OUTPUT
- name: 'Install arm-none-eabi-gcc'
uses: ryanwinter/arm-none-eabi-gcc@master
with:
release: '10-2021.10'
- name: 'Install protoc'
uses: arduino/setup-protoc@v2
- name: 'Install python tools'
run: python3 -m pip install protobuf grpcio-tools
- name: 'Build firmware'
run: |
pushd build;
cmake -DCMAKE_BUILD_TYPE=Release ../;
make -j"$(getconf _NPROCESSORS_ONLN)";
popd;
- name: 'Make artifacts directory'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
rm -rf artifacts;
mkdir artifacts;
- name: 'Move upload files'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
mv build/app/firmware.elf artifacts/vgm-rp2040-firmware-${SUFFIX}.elf;
mv build/app/firmware.bin artifacts/vgm-rp2040-firmware-${SUFFIX}.bin;
mv build/app/firmware.uf2 artifacts/vgm-rp2040-firmware-${SUFFIX}.uf2;
mv build/app/firmware.elf.map artifacts/vgm-rp2040-firmware-${SUFFIX}.map;
- name: 'Upload artifacts to update server'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
FILES=$(for CUR in $(ls artifacts/); do echo "-F files=@artifacts/$CUR"; done)
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
-F "branch=${BRANCH_NAME}" \
${FILES[@]} \
"${{ secrets.INDEXER_URL }}"/vgm-firmware/uploadfiles;