-
Notifications
You must be signed in to change notification settings - Fork 255
164 lines (143 loc) · 5.72 KB
/
app-test-suite.yaml
File metadata and controls
164 lines (143 loc) · 5.72 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
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
name: Apps Test Suite
on:
pull_request: {}
jobs:
changed-files:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
changed-apps-1: ${{ steps.changed-apps.outputs.changed-apps-1 }}
change-count-1: ${{ steps.changed-apps.outputs.change-count-1 }}
changed-apps-2: ${{ steps.changed-apps.outputs.changed-apps-2 }}
change-count-2: ${{ steps.changed-apps.outputs.change-count-2 }}
changed-apps-3: ${{ steps.changed-apps.outputs.changed-apps-3 }}
change-count-3: ${{ steps.changed-apps.outputs.change-count-3 }}
steps:
- name: Check Docker socket ownership
run: |
ls -la /var/run/docker.sock
gid=$(stat -c '%g' /var/run/docker.sock)
echo "Docker socket group is [$gid]"
# Some apps that run rootless, we add this group to their compose file when in CI
# So those apps can connect to the Docker socket, if that changes, we need to update
# the app's compose file to use the correct group
[ $gid -eq 118 ] && exit 0
echo "Expected Docker socket group to be 118, but it's [$gid]"
exit 1
- name: Checkout
uses: actions/checkout@v6
- name: Get changed files
id: changed-files-json
uses: tj-actions/changed-files@v47
with:
json: true
write_output_files: true
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Matrix Output
id: changed-apps
run: |
out=$(python3 .github/scripts/changed_apps.py)
echo "changed-apps-1=$(echo "${out}" | jq -cr '.matrix1')" >> $GITHUB_OUTPUT
echo "changed-apps-2=$(echo "${out}" | jq -cr '.matrix2')" >> $GITHUB_OUTPUT
echo "changed-apps-3=$(echo "${out}" | jq -cr '.matrix3')" >> $GITHUB_OUTPUT
echo "change-count-1=$(echo "${out}" | jq -cr '.matrix1.include | length')" >> $GITHUB_OUTPUT
echo "change-count-2=$(echo "${out}" | jq -cr '.matrix2.include | length')" >> $GITHUB_OUTPUT
echo "change-count-3=$(echo "${out}" | jq -cr '.matrix3.include | length')" >> $GITHUB_OUTPUT
- name: Message Generation
id: message
run: |
python3 .github/scripts/message.py > pr-comment.txt
if [ "$(cat pr-comment.txt)" != "" ]; then
echo "message=true" >> $GITHUB_OUTPUT
else
echo "message=false" >> $GITHUB_OUTPUT
fi
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
if: steps.message.outputs.message == 'true'
continue-on-error: true
with:
comment-tag: notify-teams
file-path: pr-comment.txt
run-apps-matrix-1:
name: Run Docker Compose Render/Install (Matrix 1)
needs: changed-files
runs-on: ubuntu-latest
if: needs.changed-files.outputs.change-count-1 > 0
strategy:
matrix: ${{ fromJson(needs.changed-files.outputs.changed-apps-1) }}
fail-fast: false
max-parallel: 20
steps:
- name: Environment Information
run: |
echo "====== Docker Info ======"
docker info
echo "========================="
- name: Checkout
uses: actions/checkout@v6
- name: Test
shell: bash
run: |
echo "Testing [${{matrix.train}}/${{matrix.app}}/templates/test_values/${{matrix.test_file}}]"
python3 ./.github/scripts/ci.py --train ${{matrix.train}} --app ${{matrix.app}} --test-file ${{matrix.test_file}}
- name: Check Metadata
shell: bash
run: |
echo "Checking [${{matrix.train}}/${{matrix.app}}/app.yaml]"
curr_diff=$(git diff)
python3 ./.github/scripts/generate_metadata.py --train ${{matrix.train}} --app ${{matrix.app}}
new_diff=$(git diff)
if [ "$curr_diff" != "$new_diff" ]; then
git diff
echo "App metadata is not up to date"
echo "Please run [python3 ./.github/scripts/generate_metadata.py --train ${{matrix.train}} --app ${{matrix.app}}] and commit the changes"
exit 1
fi
run-apps-matrix-2:
name: Run Docker Compose Render/Install (Matrix 2)
needs: changed-files
runs-on: ubuntu-latest
if: needs.changed-files.outputs.change-count-2 > 0
strategy:
matrix: ${{ fromJson(needs.changed-files.outputs.changed-apps-2) }}
fail-fast: false
max-parallel: 20
steps:
- name: Environment Information
run: |
echo "====== Docker Info ======"
docker info
echo "========================="
- name: Checkout
uses: actions/checkout@v6
- name: Test
shell: bash
run: |
echo "Testing [${{matrix.train}}/${{matrix.app}}/templates/test_values/${{matrix.test_file}}]"
python3 ./.github/scripts/ci.py --train ${{matrix.train}} --app ${{matrix.app}} --test-file ${{matrix.test_file}}
run-apps-matrix-3:
name: Run Docker Compose Render/Install (Matrix 3)
needs: changed-files
runs-on: ubuntu-latest
if: needs.changed-files.outputs.change-count-3 > 0
strategy:
matrix: ${{ fromJson(needs.changed-files.outputs.changed-apps-3) }}
fail-fast: false
max-parallel: 20
steps:
- name: Environment Information
run: |
echo "====== Docker Info ======"
docker info
echo "========================="
- name: Checkout
uses: actions/checkout@v6
- name: Test
shell: bash
run: |
echo "Testing [${{matrix.train}}/${{matrix.app}}/templates/test_values/${{matrix.test_file}}]"
python3 ./.github/scripts/ci.py --train ${{matrix.train}} --app ${{matrix.app}} --test-file ${{matrix.test_file}}