-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (149 loc) · 5.13 KB
/
handle_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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Handle Build
on:
push:
branches: [ "handle" ]
pull_request:
branches: [ "handle" ]
workflow_dispatch: # manual trigger
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetches all history for all branches and tags
- name: Determine Version and Build Number
id: set_version
run: |
BRANCH_SUFFIX="h"
# Fetch all tags
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
# Get the latest tag that matches the branch suffix
LATEST_TAG=$(git tag --list "*${BRANCH_SUFFIX}" | sort -V | tail -n1)
if [ -z "$LATEST_TAG" ]; then
echo "No matching tags found. Setting default version."
VERSION_NUMBER="0.1"
BUILD_NUMBER="0"
else
echo "Found latest tag: $LATEST_TAG"
VERSION_NUMBER=$(echo $LATEST_TAG | sed "s/${BRANCH_SUFFIX}//g")
BUILD_NUMBER=$(git rev-list --count $LATEST_TAG..HEAD)
fi
FULL_VERSION="$VERSION_NUMBER.$BUILD_NUMBER"
echo "version=$FULL_VERSION" >> $GITHUB_OUTPUT
echo "Version Number: $FULL_VERSION"
test:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Update Package Lists
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install valgrind g++ make --fix-missing
- name: Build
run: make -j
working-directory: VortexEngine
- name: Set execute permissions for test script
run: chmod +x ./runtests.sh
working-directory: VortexEngine/tests
- name: Run general tests
run: ./runtests.sh --general
working-directory: VortexEngine/tests
embedded:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies
run: make install
- name: Build Binary
run: make build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: embedded firmware
path: |
build/VortexEngine.ino.bin
build/VortexEngine.ino.elf
build/VortexEngine.ino.map
build/VortexEngine.ino.hex
build/VortexEngine.ino.uf2
- name: Archive production artifacts for deployment
uses: actions/upload-artifact@v4
with:
name: firmware-artifact
path: build/VortexEngine.ino.uf2
wasm:
needs: embedded
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Update Package Lists
run: sudo apt-get update
- name: Install Emscripten
run: |
sudo apt install -y cmake python3
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
working-directory: VortexEngine/VortexLib
- name: Build Webassembly
run: |
source ./emsdk/emsdk_env.sh
make -j wasm
working-directory: VortexEngine/VortexLib
docs:
needs: wasm
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/handle'
steps:
- name: Checkout current repository
uses: actions/checkout@v4
- name: Update Package Lists
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install doxygen graphviz texlive --fix-missing
- name: Checkout doxygen-awesome
run: git clone https://github.com/jothepro/doxygen-awesome-css.git doxygen-awesome-css
- name: Generate Documentation
run: doxygen Doxyfile
- name: Commit and Push Documentation
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add docs
git commit -m "Update Doxygen documentation"
git push -f origin HEAD:handle-docs
deploy:
needs: [embedded, setup]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/handle'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: firmware-artifact
path: build
- name: Rename and Deploy Firmware
run: |
DEVICE_TYPE="handle"
VERSIONED_FILENAME="VortexEngine-${DEVICE_TYPE}-${{ needs.setup.outputs.version }}.uf2"
mv build/VortexEngine.ino.uf2 build/$VERSIONED_FILENAME
echo "Version is ${{ needs.setup.outputs.version }}"
echo "Filename is is $VERSIONED_FILENAME"
curl -X POST \
-F "file=@build/$VERSIONED_FILENAME" \
-F "device=$DEVICE_TYPE" \
-F "version=${{ needs.setup.outputs.version }}" \
-F "category=firmware" \
-F "clientApiKey=${{ secrets.VORTEX_COMMUNITY_API_KEY }}" \
https://vortex.community/firmware/upload