-
Notifications
You must be signed in to change notification settings - Fork 77
172 lines (150 loc) · 4.68 KB
/
github-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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: GitHub CI
on:
push:
branches: [ master, nightly ]
tags: [ '**' ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
ci-build:
strategy:
fail-fast: false
matrix:
cfg:
- name: Linux
os: ubuntu-20.04
target: linux
- name: Linux mingw64
os: ubuntu-22.04
target: linux-mingw64
- name: Mac
os: macos-11
target: mac
- name: Android
os: ubuntu-20.04
target: android
name: ${{ matrix.cfg.name }} ${{ github.ref }}
runs-on: ${{ matrix.cfg.os }}
steps:
- name: Context in env
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
JOB_CONTEXT: ${{ toJson(job) }}
STEPS_CONTEXT: ${{ toJson(steps) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: ''
- name: Checkout
uses: actions/checkout@v3
- name: Compiler cache (sccache)
uses: actions/cache@v2
with:
path: |
~/.cache/sccache
~/Library/Caches/Mozilla.sccache
key: ${{ matrix.cfg.target }}-sccache-v1-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.cfg.target }}-sccache-v1-${{ github.ref }}-
${{ matrix.cfg.target }}-sccache-v1-refs/heads/master-
${{ matrix.cfg.target }}-sccache-v1-
- name: Cache Rust deps and build output
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
key: ${{ matrix.cfg.target }}-rust-v2-${{ hashFiles('rust') }}
restore-keys: |
${{ matrix.cfg.target }}-rust-v2-${{ hashFiles('rust') }}
${{ matrix.cfg.target }}-rust-v2-
- name: Set up JDK 18
uses: actions/setup-java@v3
if: matrix.cfg.target == 'android'
with:
distribution: temurin
java-version: 18
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
if: matrix.cfg.target == 'android'
- name: Set up environment
shell: bash
run: |
. ${{ github.workspace }}/.ci/ci-setup.sh 2>&1
echo "PATH=$PATH" >> $GITHUB_ENV
env:
CI_TARGET: ${{ matrix.cfg.target }}
ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }}
- name: Build and run tests
shell: bash
run: ${{ github.workspace }}/.ci/ci-build.sh 2>&1
env:
CI_NAME: ${{ matrix.cfg.name }}
CI_OS: ${{ matrix.cfg.os }}
CI_TARGET: ${{ matrix.cfg.target }}
CI_REF: ${{ github.ref }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
- name: Publish packages
shell: bash
working-directory: ${{ github.workspace }}
run: ${{ github.workspace }}/.ci/ci-publish.sh 2>&1
env:
CI_REF: ${{ github.ref }}
GCLOUD_CREDENTIALS_SALT: ${{ secrets.GCLOUD_CREDENTIALS_SALT }}
GCLOUD_CREDENTIALS_KEY: ${{ secrets.GCLOUD_CREDENTIALS_KEY }}
GCLOUD_CREDENTIALS_IV: ${{ secrets.GCLOUD_CREDENTIALS_IV }}
- name: Upload android cmake logs
uses: actions/upload-artifact@v2
if: failure() && matrix.cfg.target == 'android'
with:
name: android-cmake-logs
path: |
**/*/cmake_server_log.txt
**/*/CMakeOutput.log
- name: Collect artifacts
shell: bash
run: |
set -e
set -x
mkdir artifacts
for file in ci-build/ja2-stracciatella_*; do
cp "${file}" artifacts/
done
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: ${{ github.workspace }}/artifacts
ci-lint:
strategy:
fail-fast: false
matrix:
cfg:
- os: ubuntu-latest
target: linux
- os: macos-latest
target: mac
- os: windows-latest
target: windows
name: lint ${{ matrix.cfg.target }} ${{ github.ref }}
runs-on: ${{ matrix.cfg.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rustup
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.rustup.rs | sh -s -- -y --default-toolchain=$(cat ./rust-toolchain)
- name: Run cargo fmt
shell: bash
working-directory: ./rust
run: cargo fmt --verbose --all --check
- name: Run cargo clippy
shell: bash
working-directory: ./rust
run: cargo clippy --all-targets --all-features --verbose -- -D warnings