Skip to content

Commit 3e243b3

Browse files
Tests refactoring (#383)
* Tests refactoring * mamba clean at end of workbench-tools install
1 parent f39b4c0 commit 3e243b3

26 files changed

Lines changed: 357 additions & 280 deletions

.github/actions/smoke-test/action.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/actions/smoke-test/test.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/test-pr.yaml

Lines changed: 47 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -23,79 +23,68 @@ jobs:
2323
strategy:
2424
matrix:
2525
common_filters:
26-
-
26+
-
2727
- '.github/workflows/test-pr.yaml'
28-
- '.github/actions/smoke-test/**'
2928
- 'startupscript/**'
30-
- 'test/**'
29+
- 'tests/common/**'
3130
config:
32-
- example:
33-
user: jovyan
34-
jupyter-template:
35-
user: jupyter
31+
- example: {}
32+
jupyter-template: {}
3633
r-analysis:
37-
user: rstudio
38-
workbench_tools: true
39-
postgres_client: true
34+
filters:
35+
- 'features/src/workbench-tools/**'
36+
- 'features/src/postgres-client/**'
4037
r-analysis-aou:
41-
user: rstudio
42-
workbench_tools: true
43-
postgres_client: true
4438
filters:
39+
- 'features/src/workbench-tools/**'
40+
- 'features/src/postgres-client/**'
4541
- 'src/aou-common/**'
4642
vscode:
47-
user: abc
48-
workbench_tools: true
49-
postgres_client: true
43+
filters:
44+
- 'features/src/workbench-tools/**'
45+
- 'features/src/postgres-client/**'
5046
vscode-docker:
51-
user: abc
52-
workbench_tools: true
47+
filters:
48+
- 'features/src/workbench-tools/**'
5349
workbench-jupyter:
5450
template: custom-workbench-jupyter-template
55-
user: jupyter
5651
maximize_build_space: true
57-
workbench_tools: true
58-
postgres_client: true
59-
options:
60-
containerImage: 'us-west2-docker.pkg.dev/shared-pub-buckets-94mvrf/workbench-artifacts/app-workbench-jupyter:ov-dev-stable'
6152
filters:
53+
- 'features/src/workbench-tools/**'
54+
- 'features/src/postgres-client/**'
6255
- 'src/jupyter-common/**'
6356
jupyter-aou:
64-
user: jupyter
6557
maximize_build_space: true
66-
workbench_tools: true
67-
postgres_client: true
6858
filters:
59+
- 'features/src/workbench-tools/**'
60+
- 'features/src/postgres-client/**'
6961
- 'src/jupyter-common/**'
7062
- 'src/aou-common/**'
7163
nemo_jupyter:
72-
user: jupyter
7364
maximize_build_space: true
74-
workbench_tools: true
75-
postgres_client: true
65+
filters:
66+
- 'features/src/workbench-tools/**'
67+
- 'features/src/postgres-client/**'
7668
nemo_jupyter_aou:
77-
user: jupyter
7869
maximize_build_space: true
79-
workbench_tools: true
80-
postgres_client: true
8170
filters:
71+
- 'features/src/workbench-tools/**'
72+
- 'features/src/postgres-client/**'
8273
- 'src/aou-common/**'
8374
- 'src/nemo_jupyter/**'
8475
workbench-jupyter-parabricks:
85-
user: jupyter
8676
maximize_build_space: true
87-
workbench_tools: true
88-
postgres_client: true
77+
filters:
78+
- 'features/src/workbench-tools/**'
79+
- 'features/src/postgres-client/**'
8980
workbench-jupyter-parabricks-aou:
90-
user: jupyter
9181
maximize_build_space: true
92-
workbench_tools: true
93-
postgres_client: true
9482
filters:
83+
- 'features/src/workbench-tools/**'
84+
- 'features/src/postgres-client/**'
9585
- 'src/aou-common/**'
9686
- 'src/workbench-jupyter-parabricks/**'
97-
ubuntu-example:
98-
user: vscode
87+
ubuntu-example: {}
9988
outputs:
10089
apps: ${{ steps.output.outputs.apps }}
10190
steps:
@@ -115,8 +104,7 @@ jobs:
115104
| .value as $v
116105
| .value = $common
117106
| .value += ["src/" + ($v.template // .key) + "/**"]
118-
| .value += if $v.workbench_tools then ["features/src/workbench-tools/**"] else [] end
119-
| .value += if $v.postgres_client then ["features/src/postgres-client/**"] else [] end
107+
| .value += ["tests/" + ($v.template // .key) + ".sh"]
120108
| .value += ($v.filters // [])
121109
] | from_entries' | yq -P >> $GITHUB_OUTPUT
122110
echo "EOF" >> $GITHUB_OUTPUT
@@ -141,11 +129,7 @@ jobs:
141129
| select(. != null)
142130
| {
143131
template: (.template // $t),
144-
user,
145132
maximize_build_space: (.maximize_build_space // false),
146-
workbench_tools: (.workbench_tools // false),
147-
postgres_client: (.postgres_client // false),
148-
options: (.options // {}),
149133
}
150134
]' >> $GITHUB_OUTPUT
151135
echo "EOF" >> $GITHUB_OUTPUT
@@ -163,6 +147,9 @@ jobs:
163147
steps:
164148
- uses: actions/checkout@v4
165149

150+
- name: Install bats
151+
run: sudo apt-get update && sudo apt-get install -y bats
152+
166153
# Free up disk space by removing unnecessary files, if needed
167154
- name: Maximize build disk space
168155
if: ${{ matrix.app.maximize_build_space }}
@@ -193,12 +180,17 @@ jobs:
193180
sudo systemctl restart containerd
194181
sudo systemctl restart docker
195182
196-
- name: Smoke test for '${{ matrix.app.template }}'
197-
id: smoke_test
198-
uses: ./.github/actions/smoke-test
199-
with:
200-
template: "${{ matrix.app.template }}"
201-
user: "${{ matrix.app.user }}"
202-
workbench_tools: "${{ matrix.app.workbench_tools }}"
203-
postgres_client: "${{ matrix.app.postgres_client }}"
204-
options: "${{ toJSON(matrix.app.options) }}"
183+
- name: Copy startup scripts
184+
run: |
185+
cp tests/common/vm-metadata.sh startupscript/gcp/
186+
for dir in src/*/; do
187+
if [[ -d "${dir}" ]]; then
188+
cp -r startupscript "${dir}"
189+
fi
190+
done
191+
192+
- name: Build '${{ matrix.app.template }}'
193+
run: tests/common/build.sh "${{ matrix.app.template }}"
194+
195+
- name: Test '${{ matrix.app.template }}'
196+
run: tests/common/test.sh "${{ matrix.app.template }}"

features/src/workbench-tools/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,6 @@ sed -i '/^# If not running interactively/,/esac/d' "${USER_HOME_DIR}/.bashrc" ||
188188
# Make sure the login user is the owner of their .bashrc
189189
chown "${USERNAME}:" "${USER_HOME_DIR}/.bashrc"
190190

191+
mamba clean --all -y
192+
191193
echo "Workbench tools installation complete!"

test/test-utils/test-utils.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/test.sh

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)