forked from dart-lang/pub-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
192 lines (186 loc) · 6.24 KB
/
Copy pathall-test.yml
File metadata and controls
192 lines (186 loc) · 6.24 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: All tests
permissions: read-all
on:
push:
branches:
- main
- master
pull_request:
schedule:
- cron: "0 0 * * 0" # runs on every Sunday
env:
PUB_ENVIRONMENT: bot.github
DART_SDK_VERSION: '3.12.0'
jobs:
app_build_only:
name: app/ (build only)
runs-on: ubuntu-latest
steps:
- name: Cache PUB_CACHE
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.pub-cache
key: ${{runner.os}}-pub-cache
- name: Setup Dart SDK
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
with:
sdk: ${{env.DART_SDK_VERSION}}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: dart pub get
- name: Install webp
run: sudo apt-get update -yq && sudo apt-get install webp
- run: dart analyze --fatal-infos .
working-directory: app/
- run: dart format --output=none --set-exit-if-changed .
working-directory: app/
- run: dart test -P build-only -j 1
working-directory: app/
app_test:
name: app/ (shard ${{matrix.shard}})
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Cache PUB_CACHE
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.pub-cache
key: ${{runner.os}}-pub-cache
- name: Setup Dart SDK
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
with:
sdk: ${{env.DART_SDK_VERSION}}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: dart pub get
- name: Install webp
run: sudo apt-get update -yq && sudo apt-get install webp
- run: dart test -P presubmit --shard-index ${{matrix.shard}} --total-shards 8
working-directory: app/
env:
PUB_POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable
pub_integration_test:
name: pkg/pub_integration/ (shard ${{matrix.shard}})
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 4]
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Cache PUB_CACHE
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.pub-cache
key: ${{runner.os}}-pub-cache
- name: Setup Dart SDK
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
with:
sdk: ${{env.DART_SDK_VERSION}}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: dart pub get
- run: dart tool/trigger_puppeteer_download.dart
working-directory: pkg/pub_integration
- run: find test/ -type f -name "*_test.dart" | awk -v shard="${{ strategy.job-index }}" -v total="${{ strategy.job-total }}" 'NR % total == shard' | xargs -I {} dart test -j 1 --run-skipped {}
working-directory: pkg/pub_integration
env:
PUB_POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable
define_pkg_list:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: List packages
id: packages
run: |
DIRS=$(find . -maxdepth 1 -mindepth 1 -type d -printf '"%f"\n' | grep -v pub_integration | tr '\n' ',' | sed 's/,$//')
echo "packages=[$DIRS]" >> $GITHUB_OUTPUT
working-directory: pkg/
test_packages:
name: pkg/${{matrix.package}}/
runs-on: ubuntu-latest
needs: define_pkg_list
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.define_pkg_list.outputs.packages) }}
steps:
- name: Enable unprivileged user namespaces
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Cache PUB_CACHE
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.pub-cache
key: ${{runner.os}}-pub-cache
- name: Setup Dart SDK
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
with:
sdk: ${{env.DART_SDK_VERSION}}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: dart pub get
- run: dart analyze --fatal-infos .
working-directory: pkg/${{matrix.package}}
- run: dart format --output=none --set-exit-if-changed .
working-directory: pkg/${{matrix.package}}
- name: Check for test directory
id: check_test_dir
run: |
if [ -d "pkg/${{matrix.package}}/test" ]; then
echo "Test directory found for ${{matrix.package}}."
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "No test directory found for ${{matrix.package}}. Skipping tests."
echo "exists=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Run tests
if: steps.check_test_dir.outputs.exists == 'true'
run: dart test --run-skipped
working-directory: pkg/${{matrix.package}}
env:
PUB_POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable