forked from gianlucag/SidBerry
-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (148 loc) · 5.11 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
name: USBSIDBerry Build
env:
BUILD_THREADS: 4
BUILD_TYPE: Release
on:
push:
paths:
- "src/**"
- ".github/workflows/build.yml"
- "CMakeLists.txt"
# Only run on dev branch
branches: [dev]
# Allows you to run this workflow manually from the Actions tab when needed
workflow_dispatch:
# CMake info: https://www.msys2.org/docs/cmake/
jobs:
build_deb:
name: Build Debian/Ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {
name: USBSIDBerry,
directory: sidberry,
filename: usbsidberry,
}
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: 🛠️ Install Act dependencies
if: ${{ env.ACT }}
run: |
apt-get update && apt-get install sudo -y
- name: 🛠️ Install dependencies
run: |
sudo apt update
sudo apt install -y curl \
build-essential \
cmake \
libusb-1.0-0 \
libusb-1.0-0-dev \
libusb-dev \
udev
- name: 📇 Checkout project
uses: actions/checkout@v4
with:
submodules: recursive
path: master
- name: 🏭 Create build folders
run: |
mkdir -p ${{github.workspace}}/master/build_${{matrix.directory}}
- name: 🏭 Setup CMAKE
run: |
cmake -S master -B ${{github.workspace}}/master/build_${{matrix.directory}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} $extra_arg
- name: 🏭 Build ${{matrix.name}}
run: |
cmake --build ${{github.workspace}}/master/build_${{matrix.directory}} --config ${{env.BUILD_TYPE}} -j ${{env.BUILD_THREADS}}
- name: List build files
run: |
ls ${{github.workspace}}/master/build_${{matrix.directory}}/usbsidberry -la
- name: 💾 Gather Artifact Files
working-directory: ${{github.workspace}}/master
run: |
mkdir dist
cp -av build_${{matrix.directory}}/usbsidberry dist/${{matrix.filename}}
- name: Get current branch
run: |
echo "BRANCHNAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Get current datetime
run: |
echo "DATETIME=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_ENV
- name: 💾 Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.name}}-${{env.BRANCHNAME}}-autobuild-${{github.run_number}}-${{env.DATETIME}}
path: ${{github.workspace}}/master/dist
build_win:
name: Build Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- {
name: USBSIDBerryWin,
directory: sidberry,
filename: "usbsidberry.exe",
system: MINGW64,
arch: x86_64,
prefix: mingw64,
}
steps:
- shell: bash
run: git config --global core.autocrlf input
- name: 🛠️ Install dependencies
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.system }}
update: true
install: >-
git
mingw-w64-${{ matrix.arch }}-cmake
mingw-w64-${{ matrix.arch }}-make
mingw-w64-${{ matrix.arch }}-pkgconf
mingw-w64-${{ matrix.arch }}-curl
mingw-w64-${{ matrix.arch }}-toolchain
mingw-w64-${{ matrix.arch }}-libusb
- name: 📇 Checkout project
uses: actions/checkout@v4
with:
submodules: recursive
- name: 🏭 Create build folders
shell: msys2 {0}
run: |
mkdir -p build_${{matrix.directory}}
- name: 🏭 Setup CMAKE
shell: msys2 {0}
run: |
cmake -G "MinGW Makefiles" -S . -B build_${{matrix.directory}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ $extra_arg
- name: 🏭 Build ${{matrix.name}}
id: build
shell: msys2 {0}
run: |
MINGW_INSTALLS=${{ matrix.system }} cmake --build build_${{matrix.directory}} --config ${{env.BUILD_TYPE}} -j ${{env.BUILD_THREADS}}
- name: List build files
shell: msys2 {0}
run: |
ls build_${{matrix.directory}}/usbsidberry -la
- name: 💾 Gather Artifact Files
shell: msys2 {0}
run: |
mkdir dist
cp -av build_${{matrix.directory}}/usbsidberry dist/${{matrix.filename}}
- name: Get current branch
shell: msys2 {0}
run: |
echo "BRANCHNAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Get current datetime
shell: msys2 {0}
run: |
echo "DATETIME=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_ENV
- name: 💾 Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.name}}-${{env.BRANCHNAME}}-autobuild-${{github.run_number}}-${{env.DATETIME}}
path: dist