forked from ArtemioUrbina/huc
-
Notifications
You must be signed in to change notification settings - Fork 12
187 lines (179 loc) · 5.78 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
182
183
184
185
186
187
name: build
# Github Actions aren't supporting anchors yet
# upvote here https://github.com/github/feedback/discussions/4501
#
# See https://github.com/marketplace/actions/setup-xcode-version
#
# Just for reference ...
#
# sudo xcode-select -s "/Applications/Xcode_13.4.1.app"
on:
push:
pull_request:
branches:
- master
# activating dispatch to allow manual runs
# workflow_dispatch:
env:
MSYS2_INSTALL_FOLDER: C:\msys64\ # provided by GitHub Actions VMs
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, macos-13, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
make
echo Build Complete
- name: Build on Windows
if: startsWith(matrix.os, 'windows')
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make mingw-w64-x86_64-gcc git --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make"
echo Build Complete
- name: Build on MacOs-13
if: startsWith(matrix.os, 'macos-13')
run: |
make
echo Build Complete
- name: Build on MacOs-14
if: startsWith(matrix.os, 'macos-14')
run: |
make
echo Build Complete
- name: Archive toolchain
uses: actions/upload-artifact@v4
with:
name: toolchain-${{ matrix.os }}
path: |
bin
examples/**/*.iso
examples/**/*.pce
examples/**/*.sgx
tgemu/tgemu*
test:
strategy:
matrix:
os: [ubuntu-22.04, macos-13, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts
uses: actions/download-artifact@v4
with:
name: toolchain-${{ matrix.os }}
- name: Restore Execute Flags
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: |
chmod +x bin/* # Github Action artifacts don't keep exec flags https://github.com/actions/upload-artifact#permission-loss'
chmod +x tgemu/tgemu
- name: Run tests on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
make check
make test
echo Test Complete
- name: Setup Msys2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: coreutils make git
- name: Run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: msys2 {0}
run: |
make check
make test
echo Build Complete
- name: Run tests on Mac
if: startsWith(matrix.os, 'macos')
run: |
make check
make test
echo Build Complete
package:
strategy:
matrix:
os: [ubuntu-22.04, macos-13, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previously built artifacts
uses: actions/download-artifact@v4
with:
name: toolchain-${{ matrix.os }}
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'ubuntu')
run: |
make package
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'windows')
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make git zip --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make package"
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'macos')
run: |
make package
echo Package Complete
- name: Archive package
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: |
*.zip
if-no-files-found: error
publish_package:
runs-on: ubuntu-latest
needs: [package, test]
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts win64
uses: actions/download-artifact@v4
with:
name: package-windows-2022
- name: Get previously built artifacts macos
uses: actions/download-artifact@v4
with:
name: package-macos-13
- name: Get previously built artifacts linux
uses: actions/download-artifact@v4
with:
name: package-ubuntu-22.04
# https://github.com/pyTooling/Actions/tree/main/releaser
# need to use composite on windows, since docker isn't available
- name: publish release package
if: ${{ github.event_name == 'release' }}
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
rm: true # do not keep old latest artifacts
files: |
*.zip
- name: publish current package
if: ${{ github.event_name != 'release' }}
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "current"
rm: true # do not keep old latest artifacts
files: |
*.zip