-
Notifications
You must be signed in to change notification settings - Fork 476
138 lines (115 loc) · 5.01 KB
/
ubuntu-build.yml
File metadata and controls
138 lines (115 loc) · 5.01 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
name: Ubuntu Build
on:
push:
branches:
- "master"
- "test_workflow*"
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
name: "${{ matrix.os-name }} | NDK-${{ matrix.ndk }} | ${{ matrix.build-system }} | ${{ matrix.ffmpeg }} | ${{ matrix.page-size }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(github.event_name == 'pull_request' && '[{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r29","build-system":"cmake","ffmpeg":"with-ffmpeg","page-size":"16kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r27c","build-system":"ndk-build","ffmpeg":"no-ffmpeg","page-size":"4kb"}]' || '[{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r27c","build-system":"cmake","ffmpeg":"with-ffmpeg","page-size":"4kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r27c","build-system":"cmake","ffmpeg":"with-ffmpeg","page-size":"16kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r27c","build-system":"cmake","ffmpeg":"no-ffmpeg","page-size":"4kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r27c","build-system":"cmake","ffmpeg":"no-ffmpeg","page-size":"16kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r29","build-system":"cmake","ffmpeg":"with-ffmpeg","page-size":"4kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r29","build-system":"cmake","ffmpeg":"with-ffmpeg","page-size":"16kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r29","build-system":"cmake","ffmpeg":"no-ffmpeg","page-size":"4kb"},{"os":"ubuntu-latest","os-name":"Ubuntu","ndk":"r29","build-system":"cmake","ffmpeg":"no-ffmpeg","page-size":"16kb"}]') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup NDK
uses: nttld/setup-ndk@v1.4.2
id: setup-ndk
with:
ndk-version: ${{ matrix.ndk }}
link-to-sdk: true
add-to-path: true
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for scripts (Unix)
if: runner.os != 'Windows'
run: chmod +x gradlew tasks.sh
- name: Configure build parameters
shell: bash
run: |
# Set build system flag
if [ "${{ matrix.build-system }}" == "cmake" ]; then
echo "BUILD_SYSTEM_FLAG=--enable-cmake" >> $GITHUB_ENV
else
echo "BUILD_SYSTEM_FLAG=" >> $GITHUB_ENV
fi
# Set FFmpeg flag
if [ "${{ matrix.ffmpeg }}" == "with-ffmpeg" ]; then
echo "FFMPEG_FLAG=--enable-video-module" >> $GITHUB_ENV
else
echo "FFMPEG_FLAG=--disable-video-module" >> $GITHUB_ENV
fi
# Set page size flag
if [ "${{ matrix.page-size }}" == "16kb" ]; then
echo "PAGE_SIZE_FLAG=--enable-16kb-page-size" >> $GITHUB_ENV
else
echo "PAGE_SIZE_FLAG=--disable-16kb-page-size" >> $GITHUB_ENV
fi
# Set artifact name
OS_SHORT="${{ runner.os }}"
NDK_SHORT="${{ matrix.ndk }}"
BUILD_SYS="${{ matrix.build-system }}"
if [ "${{ matrix.ffmpeg }}" == "with-ffmpeg" ]; then
FFMPEG_SHORT="ffmpeg"
else
FFMPEG_SHORT="noffmpeg"
fi
PAGE_SHORT="${{ matrix.page-size }}"
echo "ARTIFACT_NAME=apk-${OS_SHORT}-${NDK_SHORT}-${BUILD_SYS}-${FFMPEG_SHORT}-${PAGE_SHORT}" >> $GITHUB_ENV
- name: Setup project (ndk-build mode)
if: matrix.build-system == 'ndk-build'
shell: bash
run: ./tasks.sh --setup-project
- name: Build APK
shell: bash
run: ./tasks.sh --release $BUILD_SYSTEM_FLAG $FFMPEG_FLAG $PAGE_SIZE_FLAG --build
- name: Find and rename APK
shell: bash
run: |
APK_FILE=$(find "cgeDemo/build" -name "*.apk" | grep -i release | head -n 1)
if [ -z "$APK_FILE" ]; then
echo "Error: No release APK found in cgeDemo/build"
exit 1
fi
mkdir -p artifacts
cp "$APK_FILE" "artifacts/cgeDemo-${{ env.ARTIFACT_NAME }}.apk"
echo "APK saved as: artifacts/cgeDemo-${{ env.ARTIFACT_NAME }}.apk"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifacts/*.apk
compression-level: 0
retention-days: 15
if-no-files-found: error
lint:
name: Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run lint
run: ./gradlew lint