-
Notifications
You must be signed in to change notification settings - Fork 12
143 lines (130 loc) · 4.17 KB
/
compile.yml
File metadata and controls
143 lines (130 loc) · 4.17 KB
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
name: CI Emscripten
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
id-token: write # required by attest-build-provenance, softprops/action-gh-release
attestations: write # required by attest-build-provenance, softprops/action-gh-release
contents: write # required by softprops/action-gh-release
jobs:
build-environment:
name: Build Environment
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Cache Apt Packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: p7zip-full binutils-mips-linux-gnu build-essential pkgconf python3 git zip jq wget curl patch cmake sshfs rsync
version: 1.0
- name: Cleanup Environment
run: |
rm -fR ./emsdk
rm -fR ./compile
rm -fR ./output
rm -fR ./artifacts
- name: Install Emscripten
env:
EMSCRIPTEN_VERSION: ${{ vars.EMSCRIPTENSDKVERSION }}
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${EMSCRIPTEN_VERSION}
./emsdk activate ${EMSCRIPTEN_VERSION}
source ./emsdk_env.sh
cd ..
get-jobs:
name: Get Jobs
needs: build-environment
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::$(bash ./build.sh --list --core-names-only | jq -Rsc '. / "\n" - [""]')"
build-core:
name: Build Core
needs:
- build-environment
- get-jobs
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
continue-on-error: true
strategy:
matrix:
core: ${{fromJson(needs.get-jobs.outputs.matrix)}}
steps:
- name: Build Cores
run: |
source "emsdk/emsdk_env.sh"
bash build.sh --core=${{ matrix.core }}
- name: Move core
run: |
mkdir -p ./artifacts
mv ./output/${{ matrix.core }}.zip ./artifacts/${{ matrix.core }}.zip
- uses: actions/attest-build-provenance@v2
with:
subject-path: './artifacts/${{ matrix.core }}.zip'
package:
name: Package
needs: build-core
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
steps:
- name: Zip files
run: |
cd ./output
zip -r '../artifacts/cores.zip' * -x '*.zip'
cd ..
- uses: actions/attest-build-provenance@v2
with:
subject-path: './artifacts/cores.zip'
release:
name: Release
needs: package
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: artifacts/cores.zip
upload-nightly-cdn:
name: Upload nightly to CDN
needs:
- get-jobs
- build-core
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
steps:
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{secrets.SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa
echo "Host ${{ secrets.SSH_HOST }}" > ~/.ssh/config
echo " User ${{ secrets.SSH_USERNAME }}" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
ssh-keyscan ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa
- name: Replace remote files
run: |
rsync -Pavz -e "ssh -i $HOME/.ssh/id_rsa" ./output/ ${{ secrets.SSH_USERNAME}}@${{secrets.SSH_HOST}}:/
release-core:
name: Release Core
needs:
- get-jobs
- build-core
runs-on: [ self-hosted, linux, x64, emulatorjs-build ]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
core: ${{fromJson(needs.get-jobs.outputs.matrix)}}
steps:
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: artifacts/${{ matrix.core }}.zip