-
-
Notifications
You must be signed in to change notification settings - Fork 62
85 lines (83 loc) · 3.03 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
on:
push:
branches:
- 'build/*'
tags: [ 'v*' ]
pull_request:
types: [ opened, synchronize, reopened, labeled ]
workflow_dispatch:
name: Build
jobs:
build:
name: Build ${{ matrix.target }} for ${{ matrix.os.arch }}
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CI-build') }}
runs-on: ${{ matrix.os.name }}
strategy:
fail-fast: false
matrix:
os:
- name: macos-12
arch: x86_64
- name: macos-14
arch: aarch64
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- arm-unknown-linux-gnueabi
- arm-unknown-linux-gnueabihf
- arm-unknown-linux-musleabihf
- mipsel-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install crosstool-ng
run: |
brew install coreutils
brew install --HEAD crosstool-ng
# fix python env in the runner
brew unlink [email protected] && brew link --overwrite [email protected]
python3 --version
- name: Mount volumes
run: |
set -ex
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 16g -volname build build.dmg
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 1g -volname tools tools.dmg
hdiutil attach build.dmg.sparseimage
hdiutil attach tools.dmg.sparseimage
ls /Volumes
- name: Build Toolchain
run: |
set -ex
mkdir /Volumes/build/src
cd ${{ matrix.target }}
ct-ng build -j $(($(nproc) - 1))
- name: Tail build.log on failure
if: ${{ failure() }}
run: tail -n 500 ${{ matrix.target }}/build.log
- name: Archive Toolchain
run: |
set -ex
cd /Volumes/tools
tar czf ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz ${{ matrix.target }}
cd -
mv /Volumes/tools/${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz .
sha256sum ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz | tee ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz.sha256
- name: Upload Toolchain
uses: actions/upload-artifact@v4
with:
name: toolchain-${{ matrix.target }}-${{ matrix.os.arch }}-darwin
path: ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz
if-no-files-found: error
- name: Upload Toolchain to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz*
file_glob: true
tag: ${{ github.ref }}