-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (67 loc) · 2.06 KB
/
presubmit.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
name: Presubmit
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ninja
shell: bash
run: |
set -x
sudo apt install ninja-build
- name: Setup environement variables
shell: bash
run: |
set -x
echo "android=$(realpath ${{ github.workspace }}/../android)" >> $GITHUB_ENV
echo "key=$(git log -1 --format='%h' tests/*/checkout.sh tests/*/gen-ninja.sh)" >> $GITHUB_ENV
echo "tmp_dir=$(realpath ${{ github.workspace }}/../tmp)" >> $GITHUB_ENV
- name: Get repositories from cache
id: checkout-repositories
uses: actions/cache@v4
with:
path: ${{ env.tmp_dir }}
key: ${{ env.key }}
- name: Tests w/o cache
if: steps.checkout-repositories.outputs.cache-hit != 'true'
shell: bash
env:
N2S_TMP_PATH: ${{ env.tmp_dir }}
N2S_NDK_PATH: ${{ env.android }}
run: |
set -x
mkdir -p "${{ env.android }}"
for repo in tests/*
do
bash "${repo}/checkout.sh" "${{ env.android }}"
done
PATH="${{ env.android }}/depot_tools:${PATH}" cargo run --release -- --skip-build --aosp-path "${{ env.android }}"
- name: Tests w/ cache
if: steps.checkout-repositories.outputs.cache-hit == 'true'
shell: bash
env:
N2S_TMP_PATH: ${{ env.tmp_dir }}
N2S_NDK_PATH: ${{ env.android }}
run: |
set -x
mkdir -p "${{ env.android }}"
PATH="${{ env.android }}/depot_tools:${PATH}" cargo run --release -- --skip-gen-ninja --aosp-path "${{ env.android }}"
- name: Check generated files
shell: bash
run: |
set -x
git diff --exit-code
- name: Check format
shell: bash
run: |
set -x
find -name *.rs -exec rustfmt {} \+
git diff --exit-code