-
Notifications
You must be signed in to change notification settings - Fork 68
170 lines (144 loc) · 5.16 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
# The GCC toolchain is stored in the GitHub Actions cache after being built. To
# minimize build times, all the toolchain build steps are skipped if there is a
# cached copy of the toolchain that has not expired. The cache is shared across
# all actions in a repo.
name: Build PSn00bSDK
on: [ push, pull_request ]
jobs:
build-toolchain:
name: Build GCC toolchain
runs-on: ubuntu-latest
steps:
- name: Initialize toolchain cache
id: cache
uses: actions/cache@v3.3.2
with:
enableCrossOsArchive: true
key: gcc
path: gcc
- name: Install prerequisites
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends make g++-mingw-w64-x86-64
- name: Fetch repo contents
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
path: psn00bsdk
- name: Build toolchain for Linux
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
cd gcc
../psn00bsdk/.github/scripts/build_toolchain.sh gcc-mipsel-none-elf-linux mipsel-none-elf
echo "${{ github.workspace }}/gcc/gcc-mipsel-none-elf-linux/bin" >>$GITHUB_PATH
- name: Build toolchain for Windows
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
cd gcc
../psn00bsdk/.github/scripts/build_toolchain.sh gcc-mipsel-none-elf-windows mipsel-none-elf x86_64-w64-mingw32
build-psn00bsdk-windows:
name: Build PSn00bSDK on Windows
runs-on: windows-2022
needs: build-toolchain
steps:
- name: Add MSys2 to PATH
run: |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Initialize toolchain cache
uses: actions/cache@v3.3.2
with:
enableCrossOsArchive: true
key: gcc
path: gcc
- name: Install prerequisites
run: |
pacman -S --noconfirm mingw-w64-x86_64-ninja
- name: Fetch repo contents
uses: actions/checkout@v4
with:
path: psn00bsdk
submodules: recursive
- name: Build and package PSn00bSDK
run: |
cmake --preset ci -S psn00bsdk -G "Visual Studio 17 2022" -DPSN00BSDK_TC=${{ github.workspace }}\gcc\gcc-mipsel-none-elf-windows
cmake --build build
cmake --install build
cd dist
zip -9 -r ../psn00bsdk-windows-${{ github.ref_name }}.zip .
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: psn00bsdk-windows
path: psn00bsdk-windows-${{ github.ref_name }}.zip
build-psn00bsdk-linux:
name: Build PSn00bSDK on Linux
runs-on: ubuntu-latest
needs: build-toolchain
steps:
- name: Initialize toolchain cache
uses: actions/cache@v3.3.2
with:
enableCrossOsArchive: true
key: gcc
path: gcc
- name: Install prerequisites
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends ninja-build
- name: Fetch repo contents
uses: actions/checkout@v4
with:
path: psn00bsdk
submodules: recursive
- name: Build and package PSn00bSDK
run: |
cmake --preset ci -S psn00bsdk -G "Ninja" -DPSN00BSDK_TC=${{ github.workspace }}/gcc/gcc-mipsel-none-elf-linux
cmake --build build
cmake --install build
cd dist
zip -9 -r ../psn00bsdk-linux-${{ github.ref_name }}.zip .
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: psn00bsdk-linux
path: psn00bsdk-linux-${{ github.ref_name }}.zip
# This job takes care of creating a new release and upload the build
# artifacts if the last commit is associated to a tag.
create-release:
name: Create release
runs-on: ubuntu-latest
needs: [ build-psn00bsdk-windows, build-psn00bsdk-linux ]
steps:
- name: Initialize toolchain cache
if: ${{ github.ref_type == 'tag' }}
uses: actions/cache@v3.3.2
with:
enableCrossOsArchive: true
key: gcc
path: gcc
- name: Fetch repo contents
if: ${{ github.ref_type == 'tag' }}
uses: actions/checkout@v4
with:
path: psn00bsdk
- name: Generate release notes
if: ${{ github.ref_type == 'tag' }}
run: |
python3 psn00bsdk/.github/scripts/generate_release_notes.py -v ${{ github.ref_name }} -o release.md psn00bsdk/CHANGELOG.md
- name: Fetch build artifacts
if: ${{ github.ref_type == 'tag' }}
uses: actions/download-artifact@v4
with:
path: .
- name: Publish release
if: ${{ github.ref_type == 'tag' }}
uses: softprops/action-gh-release@v1
with:
#fail_on_unmatched_files: true
body_path: release.md
files: |
gcc/*.zip
psn00bsdk-windows/*.zip
psn00bsdk-linux/*.zip