File tree 7 files changed +92
-15
lines changed
7 files changed +92
-15
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,3 @@ ENV DEVCONTAINER=true
13
13
14
14
# Install additional tools for devcontainer template development
15
15
RUN apt install -y jq shellcheck
16
- RUN npm install -g @devcontainers/cli
Original file line number Diff line number Diff line change 6
6
"features" : {
7
7
"ghcr.io/devcontainers/features/docker-in-docker:2" : {}
8
8
},
9
+ "postCreateCommand" : " npm install" ,
9
10
"customizations" : {
10
11
"vscode" : {
11
12
"extensions" : [
Original file line number Diff line number Diff line change 7
7
pull_request :
8
8
9
9
jobs :
10
- test :
11
- name : " Run test suite for templates"
10
+ setup :
11
+ name : " Setup environment and determine templates"
12
12
runs-on : ubuntu-latest
13
+ outputs :
14
+ template_dirs : ${{ steps.get-dirs.outputs.dirs }}
13
15
steps :
14
16
- name : Checkout
15
17
uses : actions/checkout@v3
16
18
17
- - name : Setup node
18
- uses : actions/setup-node@v3
19
+ - uses : actions/setup-node@v4
19
20
with :
20
- node-version : 18
21
+ node-version : 20
22
+ cache : npm
21
23
22
- - name : Install devcontainer CLI
23
- run : npm install -g @devcontainers/cli
24
+ - name : Install Node.js dependencies
25
+ run : npm ci
26
+
27
+ - name : Get list of test directories
28
+ id : get-dirs
29
+ run : echo "dirs=$(ls -d test/*/ | jq -R -s -c 'split("\n")[:-1] | map(split("/")[1])')" >> $GITHUB_OUTPUT
30
+
31
+ lint :
32
+ name : " Run linting"
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - name : Checkout
36
+ uses : actions/checkout@v3
24
37
25
38
- name : Run linting
26
39
run : test/lint.sh
27
40
28
- # TODO: This'll do for now, but generalise these soon
29
- - name : Run barebones-nodejs template test
30
- run : test/barebones-nodejs/test.sh
31
- - name : Run barebones-ruby template test
32
- run : test/barebones-ruby/test.sh
41
+ test-templates :
42
+ name : " Run template tests"
43
+ needs : setup
44
+ runs-on : ubuntu-latest
45
+ strategy :
46
+ matrix :
47
+ template : ${{ fromJson(needs.setup.outputs.template_dirs) }}
48
+ fail-fast : false
49
+ steps :
50
+ - name : Checkout
51
+ uses : actions/checkout@v3
52
+
53
+ - uses : actions/setup-node@v4
54
+ with :
55
+ node-version : 20
56
+ cache : npm
57
+
58
+ - run : npx devcontainer --version
59
+
60
+ - name : Run test for ${{ matrix.template }}
61
+ run : test/${{ matrix.template }}/test.sh
Original file line number Diff line number Diff line change
1
+ node_modules /
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " devcontainer-templates" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " A set of devcontainer templates following the nascent devcontainer template spec." ,
5
+ "repository" : {
6
+ "type" : " git" ,
7
+ "url" : " git+https://github.com/csutter/devcontainer-templates.git"
8
+ },
9
+ "author" : " Christian Sutter" ,
10
+ "license" : " MIT" ,
11
+ "bugs" : {
12
+ "url" : " https://github.com/csutter/devcontainer-templates/issues"
13
+ },
14
+ "homepage" : " https://github.com/csutter/devcontainer-templates#readme" ,
15
+ "private" : true ,
16
+ "devDependencies" : {
17
+ "@devcontainers/cli" : " ^0.66.0"
18
+ }
19
+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ setup() {
37
37
sed -i -e " s/\$ {templateOption:imageVariant}/${IMAGE_TAG} /g" " $TEST_DIR " /.devcontainer/Dockerfile
38
38
39
39
# Start devcontainer
40
- devcontainer up --workspace-folder " $TEST_DIR " --id-label " $ID_LABEL "
40
+ npx devcontainer up --workspace-folder " $TEST_DIR " --id-label " $ID_LABEL "
41
41
}
42
42
43
43
# Clean up after ourselves on success or failure
@@ -70,7 +70,7 @@ run_test() {
70
70
#
71
71
# We _want_ $cmd to be split here as it could include arguments:
72
72
# shellcheck disable=SC2086
73
- result=$( devcontainer exec --workspace-folder " $TEST_DIR " --id-label " $ID_LABEL " $cmd || true)
73
+ result=$( npx devcontainer exec --workspace-folder " $TEST_DIR " --id-label " $ID_LABEL " $cmd || true)
74
74
75
75
case " $result " in
76
76
* $expected_result * )
You can’t perform that action at this time.
0 commit comments