forked from endless-sky/endless-sky
-
Notifications
You must be signed in to change notification settings - Fork 9
121 lines (115 loc) · 4.08 KB
/
ci.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
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
name: CI
on:
push:
# Run for pushes to master or a version branch, e.g. a PR was merged ...
branches:
- android
# ... and only when we've possibly changed how the game will function.
paths:
- 'android/**'
- 'source/**'
- 'data/**'
- 'tests/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- keys.txt
pull_request:
# Run for any push to any pull request, if it modifies source code or game text.
types: [opened, synchronize]
paths:
- 'android/**'
- 'source/**'
- 'data/**'
- 'tests/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- keys.txt
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build_android:
# TODO: only build if source changed. otherwise, d/l latest continuous
runs-on: ubuntu-latest
env:
ANDROID_SDK_ROOT: /path/to/sdk
ARTIFACT: endless-mobile
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG_CERTIFICATE: ${{ secrets.ANDROID_DEBUG_KEYSTORE }}
steps:
- uses: actions/checkout@v2
- name: Install development dependencies
run: |
sudo rm /etc/apt/sources.list.d/* && sudo dpkg --clear-avail # Speed up installation and get rid of unwanted lists
sudo apt-get update
sudo apt-get install -y --no-install-recommends libsdl2-dev libpng-dev libjpeg-turbo8-dev libopenal-dev libmad0-dev libglew-dev libgl1-mesa-dev uuid-dev ccache libgles2-mesa
python3 -m pip install --user scons
- name: Set up our JDK environment
uses: actions/setup-java@v1.4.3
with:
java-version: 11
- name: Print toolchain versions
run: |
g++ -v
gcc-ar --version
ld -v
scons --version
python --version
java -version
- name: Unit Tests
run: |
scons -Qj $(nproc) opengl=gles mode=debug test;
- name: Update Environment
run: |
mkdir -p ~/.android
echo $DEBUG_CERTIFICATE | base64 -d > ~/.android/debug.keystore
- name: Compile Android
run: |
cd android/app && sh ./download_build_dependencies.sh
cd .. && ./gradlew --no-daemon assemble
- name: Upload apks
uses: actions/upload-artifact@v4
with:
name: endless-mobile-debug-latest.apk
path: android/app/build/outputs/apk/debug/app-debug.apk
- name: Install github-release
run: |
go install github.com/github-release/github-release@latest
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Set environment variables
run: |
echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV
echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV
- name: Move/Create continuous tag
run: |
git tag --force continuous ${{ github.sha }}
git push --tags --force
- name: Setup continuous release
run: |
DESCRIPTION="Triggered on $(date -u '+%Y/%m/%d, %H:%M') UTC by commit ${{ github.sha }} (@${{ github.actor }})
This is an automated build of the latest source. It may be unstable or even crash, corrupt your save or eat your kitten. Use with caution!
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo $DESCRIPTION
echo $GITHUB_ENV
echo $GITHUB_PATH
if ! github-release info -t continuous > /dev/null 2>&1; then
github-release release \
--tag continuous \
--name "Continuous Build" \
--description "$DESCRIPTION" \
--pre-release
else
github-release edit \
--tag continuous \
--name "Continuous Build" \
--description "$DESCRIPTION" \
--pre-release
fi
github-release upload \
--tag continuous \
--name endless-mobile-debug-latest.apk \
--replace \
--file android/app/build/outputs/apk/debug/app-debug.apk