forked from just-buildsystem/justbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (116 loc) · 4.63 KB
/
tests.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
name: Tests
on:
push:
branches:
- github-ci*
jobs:
debug:
name: Debug
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-22.04
steps:
- name: Restore local cache
uses: actions/cache/restore@v4
with:
path: ~/.cache/just
key: tests-${{ runner.os }}-debug
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run and prepare docker image
run: |
docker run -it -d --name ubuntu \
-v $GITHUB_WORKSPACE:/workspace \
-v ~/.cache/just:/root/.cache/just \
-w /workspace ubuntu:20.04
docker exec ubuntu bash -c "\
set -e; \
apt update; \
apt install --yes git jq curl wget clang libstdc++-10-dev patch; \
git config --global --add safe.directory /workspace; \
git config --global --add safe.directory /root/.cache/just/git; \
export PREFIX=/usr/local; \
./.github/install-just.sh"
- name: Run all tests in native mode
run: |
docker exec ubuntu bash -c "\
set -e; \
echo '{\"DEBUG\":true,\"TEST_ENV\":{},\"DROP_LARGE_TESTS\":true}' > debug-native.conf; \
just-mr --main 'just tests' build -c debug-native.conf ALL"
- name: Run all tests in compatible mode
run: |
docker exec ubuntu bash -c "\
set -e; \
echo '{\"DEBUG\":true,\"TEST_ENV\":{\"COMPATIBLE\":\"YES\"},\"DROP_LARGE_TESTS\":true}' > debug-compat.conf; \
just-mr --main 'just tests' build -c debug-compat.conf ALL"
- name: Run garbage collector and clean cache
run: |
docker exec ubuntu bash -c "set -e; just gc"
gh extension install actions/gh-actions-cache
if [ -n "$(gh actions-cache list -R ${GITHUB_REPOSITORY} -B ${GITHUB_REF} --key 'tests-${{ runner.os }}-debug')" ]; then
gh actions-cache delete "tests-${{ runner.os }}-debug" -R ${GITHUB_REPOSITORY} -B ${GITHUB_REF} --confirm
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store local cache
uses: actions/cache/save@v4
if: ${{ !cancelled() }}
with:
path: ~/.cache/just
key: tests-${{ runner.os }}-debug
release:
name: Release
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-22.04
steps:
- name: Restore local cache
uses: actions/cache/restore@v4
with:
path: ~/.cache/just
key: tests-${{ runner.os }}-release
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run and prepare docker image
run: |
docker run -it -d --name ubuntu \
-v $GITHUB_WORKSPACE:/workspace \
-v ~/.cache/just:/root/.cache/just \
-w /workspace ubuntu:20.04
docker exec ubuntu bash -c "\
set -e; \
apt update; \
apt install --yes git jq curl wget clang libstdc++-10-dev patch; \
git config --global --add safe.directory /workspace; \
git config --global --add safe.directory /root/.cache/just/git; \
export PREFIX=/usr/local; \
./.github/install-just.sh"
- name: Run all tests in native mode
run: |
docker exec ubuntu bash -c "\
set -e; \
echo '{\"DEBUG\":false,\"TEST_ENV\":{},\"DROP_LARGE_TESTS\":true}' > release-native.conf; \
just-mr --main 'just tests' build -c release-native.conf ALL"
- name: Run all tests in compatible mode
run: |
docker exec ubuntu bash -c "\
set -e; \
echo '{\"DEBUG\":false,\"TEST_ENV\":{\"COMPATIBLE\":\"YES\"},\"DROP_LARGE_TESTS\":true}' > release-compat.conf; \
just-mr --main 'just tests' build -c release-compat.conf ALL"
- name: Run garbage collector and clean cache
run: |
docker exec ubuntu bash -c "set -e; just gc"
gh extension install actions/gh-actions-cache
if [ -n "$(gh actions-cache list -R ${GITHUB_REPOSITORY} -B ${GITHUB_REF} --key 'tests-${{ runner.os }}-release')" ]; then
gh actions-cache delete "tests-${{ runner.os }}-release" -R ${GITHUB_REPOSITORY} -B ${GITHUB_REF} --confirm
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store local cache
uses: actions/cache/save@v4
if: ${{ !cancelled() }}
with:
path: ~/.cache/just
key: tests-${{ runner.os }}-release