-
-
Notifications
You must be signed in to change notification settings - Fork 44
181 lines (164 loc) · 6.79 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build
on: [push, pull_request]
jobs:
build-firmware:
runs-on: ubuntu-latest
env:
BUILD_TYPE: "Release"
PICOSDK_VER: "1.5.1"
PICOEXTRA_VER: "sdk-1.5.1"
# The Pico-SDK will listen to these environment vars
PICO_SDK_PATH: ${{github.workspace}}/pico/pico-sdk
PICO_EXTRAS_PATH: ${{github.workspace}}/pico/pico-extras
OUTPUT_DIR: ${{github.workspace}}/binaries
steps:
- name: Checkout repo with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '12.3.Rel1'
# Since we reference stable versions of Pico-SDK and pico-extras, we can cache their downloads.
# If this were to reference changing branches (like "master"), this caching step must be removed!!!
- name: Cache Pico-SDK and Extras
id: cache-sdk
uses: actions/cache@v3
with:
path: ${{github.workspace}}/pico/
key: ${{ env.PICOSDK_VER }}-${{ env.PICOEXTRA_VER }}
# If we did not find stuff in the cache, download it fresh.
# Use method recommended by Pico SDK docs: not a full recursive clone
- name: Clone Pico-SDK
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
git clone -b "$PICOSDK_VER" --depth 1 https://github.com/raspberrypi/pico-sdk.git $PICO_SDK_PATH
cd $PICO_SDK_PATH
git submodule update --init --depth 1
- name: Clone Pico-Extras
if: steps.cache-sdk.outputs.cache-hit != 'true'
run: |
git clone -b "$PICOEXTRA_VER" --depth 1 https://github.com/raspberrypi/pico-extras.git $PICO_EXTRAS_PATH
cd $PICO_EXTRAS_PATH
git submodule update --init --depth 1
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Patch Pico SDK to allow LTO
run: sed -i 's/WRAPPER_FUNC(x) __wrap_/WRAPPER_FUNC(x) __attribute__((used)) __wrap_/' ${{env.PICO_SDK_PATH}}/src/rp2_common/pico_platform/include/pico/platform.h
- name: Build GUS Firmware
shell: bash
working-directory: ${{github.workspace}}/build
run: |
mkdir -p $OUTPUT_DIR
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="GUS" -DUSE_LTO=1 -DUSB_JOYSTICK=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-gus.uf2
- name: Build OPL / AdLib Firmware
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="OPL" -DUSE_LTO=1 -DUSB_JOYSTICK=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-adlib.uf2
- name: Build MPU401 Firmware
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="MPU" -DUSE_LTO=1 -DUSB_JOYSTICK=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-mpu.uf2
- name: Build Tandy Firmware
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="TANDY" -DUSE_LTO=1 -DUSB_JOYSTICK=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-tandy.uf2
- name: Build CMS Firmware
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="CMS" -DUSE_LTO=1 -DUSB_JOYSTICK=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-cms.uf2
- name: Build Joystick Only Firmware
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake $GITHUB_WORKSPACE/sw -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPROJECT_TYPE="JOY" -DUSE_LTO=1
cmake --build . --config $BUILD_TYPE --parallel $(nproc)
cp picogus.uf2 $OUTPUT_DIR/pg-joyex.uf2
# will generate PicoGUS Firmwares.zip as downloadable artifact with all .uf2 files
- name: Upload All Firmwares
uses: actions/upload-artifact@v3
with:
name: PicoGUS Firmwares
path: ${{env.OUTPUT_DIR}}
build-pgusinit:
runs-on: ubuntu-latest
env:
BUILD_TYPE: "Release"
OUTPUT_DIR: ${{github.workspace}}/binaries
steps:
- name: Checkout repo with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install OpenWatcom 2.0
uses: open-watcom/setup-watcom@v0
with:
version: "2.0"
- name: Build pgusinit
working-directory: ${{github.workspace}}/pgusinit
run: |
mkdir -p $OUTPUT_DIR
make -f Makefile-cross INCLUDE="$WATCOM"/h
cp pgusinit.exe $OUTPUT_DIR
# will generate pgusinit.zip as downloadable artifact with pgusinit.exe
- name: Upload pgusinit
uses: actions/upload-artifact@v3
with:
name: pgusinit
path: ${{env.OUTPUT_DIR}}/pgusinit.exe
create-release:
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
runs-on: ubuntu-latest
needs: [build-firmware, build-pgusinit]
env:
STAGING_DIR: ${{github.workspace}}/release-staging-dir
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Copy README
run: |
mkdir -p $STAGING_DIR
cp pgusinit/README.md $STAGING_DIR/README.md
- name: Get Tags
id: tag
uses: ildug/get-tag-action@v1
- name: Generate release body
run: |
awk '/^# v${{ steps.tag.outputs.version }}/{a=1;next}/^# /{a=0}a' sw/CHANGELOG.md > release-body.md
- name: Download firmware artifact
uses: actions/download-artifact@v3
with:
name: PicoGUS Firmwares
path: ${{env.STAGING_DIR}}
- name: Download pgusinit artifact
uses: actions/download-artifact@v3
with:
name: pgusinit
path: ${{env.STAGING_DIR}}
- name: Install zip
uses: montudor/action-zip@v1
- name: Zip release
run: |
zip -9 -r ../picogus-v${{ steps.tag.outputs.version }}.zip .
working-directory: ${{env.STAGING_DIR}}
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: release-body.md
files: picogus-v${{ steps.tag.outputs.version }}.zip
draft: true