-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (71 loc) · 2.28 KB
/
go.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
name: Go
on:
push:
branches: [ "master", "workflows" ]
pull_request:
branches: [ "master", "workflows" ]
jobs:
build:
strategy:
matrix:
include:
- goos: android
goarch: arm
- goos: android
goarch: arm64
- goos: windows
goarch: amd64
- goos: windows
goarch: 386
- goos: linux
goarch: amd64
- goos: linux
goarch: 386
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Download dependencies
run: go mod download
- if: matrix.goos == 'android'
name: Set CGO_ENABLED for Android
run: echo "CGO_ENABLED=1" >> $GITHUB_ENV
- if: matrix.goos == 'android'
name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
local-cache: true
- if: matrix.goarch == 'arm'
name: Set CC for ARM
run: |
ls $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
echo "CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang" >> $GITHUB_ENV
- if: matrix.goarch == 'arm64'
name: Set CC for ARM64
run: |
ls $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
echo "CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" >> $GITHUB_ENV
- name: Build
run: go build -v -o ./bin/${{ matrix.goos }}-${{ matrix.goarch }}/oplus-updater -ldflags "-s -w" .
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
- if: matrix.goos != 'darwin'
name: UPX GitHub Action
uses: crazy-max/[email protected]
with:
files: ./bin/*/oplus-updater
args: --ultra-brute
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: oplus-updater-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./bin/${{ matrix.goos }}-${{ matrix.goarch }}/oplus-updater