-
Notifications
You must be signed in to change notification settings - Fork 45
67 lines (59 loc) · 1.79 KB
/
cross_compile.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
name: Cross Compile Go Project
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
name: Build on ${{ matrix.os }} for ${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
goarch: amd64
- os: linux
goarch: 386
- os: linux
goarch: arm
- os: linux
goarch: arm64
- os: darwin
goarch: amd64
- os: darwin
goarch: arm64
- os: windows
goarch: amd64
- os: windows
goarch: 386
- os: android
goarch: arm64
# ... Add other combinations as needed
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.1' # Set to specific Go version.
- name: Setup Android NDK (only for Android builds)
if: matrix.os == 'android'
run: |
sudo apt-get install -y wget unzip
wget https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip || exit 1
unzip android-ndk-r21e-linux-x86_64.zip || exit 1
export ANDROID_NDK_HOME=$PWD/android-ndk-r21e
echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
- name: Create output directory
run: mkdir -p output
- name: Compile Go for target
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -o output/gensokyo-${{ matrix.os }}-${{ matrix.goarch }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: gensokyo-${{ matrix.os }}-${{ matrix.goarch }}
path: output/gensokyo-${{ matrix.os }}-${{ matrix.goarch }}