@@ -15,7 +15,16 @@ concurrency:
1515jobs :
1616 cli :
1717 name : CLI
18- runs-on : ubuntu-latest
18+ runs-on : ${{ matrix.os }}-latest
19+ strategy :
20+ fail-fast : true
21+ matrix :
22+ include :
23+ - { os: ubuntu, pkg: node, os-name: linux, node: 16 }
24+ - { os: ubuntu, pkg: standalone, os-name: linux, node: 16 }
25+ - { os: macos, pkg: standalone, os-name: macos, node: 16 }
26+ - { os: windows, pkg: standalone, os-name: win, node: 16, exe-suf: '.exe' }
27+
1928 steps :
2029 - uses : actions/checkout@v3
2130 with :
@@ -24,54 +33,51 @@ jobs:
2433 shell : bash
2534 run : |
2635 VER=$(cat package.json | jq -r '.version');
36+ TAG=${VER}-${GITHUB_SHA:0:8};
2737 echo "VER=${VER}" >> $GITHUB_ENV;
28- echo "TAG=${VER}-${GITHUB_SHA:0:8}" >> $GITHUB_ENV;
38+ echo "TAG=${TAG}" >> $GITHUB_ENV;
39+ if [[ "${{ matrix.pkg }}" == "node" ]]; then
40+ echo "PKG_NPM_SCRIPT=package" >> $GITHUB_ENV;
41+ echo "ARTIFACT_SLUG=devcontainers-cli-${TAG}.tgz" >> $GITHUB_ENV;
42+ echo "ARTIFACT_PATH=devcontainers-cli-${VER}.tgz" >> $GITHUB_ENV;
43+ else
44+ echo "PKG_NPM_SCRIPT=package-standalone-${{ matrix.os-name }}-x64" >> $GITHUB_ENV;
45+ echo "ARTIFACT_SLUG=devcontainer-${{ matrix.os-name }}-x64-${TAG}${{ matrix.exe-suf }}" >> $GITHUB_ENV;
46+ echo "ARTIFACT_PATH=dist/devcontainer-${{ matrix.os-name }}-x64${{ matrix.exe-suf }}" >> $GITHUB_ENV;
47+ fi
2948 - uses : actions/setup-node@v3
3049 with :
31- node-version : ' 16.x'
32- registry-url : ' https://npm.pkg.github.com'
3350 scope : ' @microsoft'
51+ node-version : ' ${{ matrix.node }}.x'
52+ registry-url : ' https://npm.pkg.github.com'
3453 - name : Cache node_modules
3554 uses : actions/cache@v3
3655 with :
37- key : ${{ runner.os }}-${{ env.VER }}-node16 -node_modules-${{ hashFiles('**/yarn.lock', '**/package.json') }}
56+ key : ${{ runner.os }}-${{ env.VER }}-node${{ matrix.node }} -node_modules-${{ hashFiles('**/yarn.lock', '**/package.json') }}
3857 path : node_modules
3958 - name : Install Dependencies
4059 shell : bash
4160 run : yarn install --frozen-lockfile
42- - name : Type-Check
61+ - name : Type Check
62+ if : matrix.pkg == 'node'
4363 shell : bash
4464 run : yarn type-check
4565 - name : Lint
66+ if : matrix.pkg == 'node'
4667 shell : bash
4768 run : yarn lint
48- - name : Setup QEMU
49- uses : docker/setup-qemu-action@v2
50- - name : Install ldid
51- shell : bash
52- run : |
53- sudo wget --no-hsts -q -O /usr/bin/ldid "https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus6/ldid_linux_$(uname -p)";
54- sudo chmod +x /usr/bin/ldid;
55- which -a ldid;
5669 - name : Package
5770 shell : bash
58- run : yarn package && yarn package-standalone
71+ run : yarn ${{ env.PKG_NPM_SCRIPT }}
5972 - name : Upload artifacts
6073 uses : actions/upload-artifact@v3
6174 with :
62- name : devcontainers-cli-${{ env.TAG }}
63- path : |
64- devcontainers-cli-${{ env.VER }}.tgz
65- dist/devcontainer-linux-x64
66- dist/devcontainer-linux-arm64
67- dist/devcontainer-macos-x64
68- dist/devcontainer-macos-arm64
69- dist/devcontainer-win-x64.exe
70- dist/devcontainer-win-arm64.exe
75+ name : ${{ env.ARTIFACT_SLUG }}
76+ path : ${{ env.ARTIFACT_PATH }}
7177
7278 tests-matrix :
7379 needs : cli
74- name : Tests Matrix
80+ name : Test
7581 runs-on : ${{ matrix.os }}-latest
7682 strategy :
7783 fail-fast : true
@@ -107,30 +113,10 @@ jobs:
107113 --exclude src/test/cli.up.test.ts \
108114 'src/test/**/*.test.ts'"
109115 include :
110- - os : ubuntu
111- pkg : standalone
112- node : 16
113- os-name : linux
114- exe-suf : ' '
115- mocha-args : " 'src/test/**/*.test.ts'"
116- - os : macos
117- pkg : standalone
118- node : 16
119- os-name : macos
120- exe-suf : ' '
121- mocha-args : " 'src/test/**/*.test.ts'"
122- - os : windows
123- pkg : standalone
124- node : 16
125- os-name : win
126- exe-suf : ' .exe'
127- mocha-args : ' src/test/container-features/containerFeaturesOCI.test.ts'
128- - os : windows
129- pkg : standalone
130- node : 16
131- os-name : win
132- exe-suf : ' .exe'
133- mocha-args : ' src/test/container-features/generateFeaturesConfig.test.ts'
116+ - { os: ubuntu, pkg: standalone, node: 16, os-name: linux, mocha-args: 'src/test/cli.exec.{buildKit,nonBuildKit}.*.test.ts' }
117+ - { os: ubuntu, pkg: standalone, node: 16, os-name: linux, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts' }
118+ - { os: macos, pkg: standalone, node: 16, os-name: macos, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts' }
119+ - { os: windows, pkg: standalone, node: 16, os-name: win, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts', exe-suf: '.exe' }
134120 steps :
135121 - name : Checkout
136122 uses : actions/checkout@v3
@@ -145,15 +131,21 @@ jobs:
145131 echo "TAG=${TAG}" >> $GITHUB_ENV;
146132 if [[ "${{ matrix.pkg }}" == "node" ]]; then
147133 echo "TEST_STANDALONE_PKG=0" >> $GITHUB_ENV;
134+ echo "ARTIFACT_PATH=." >> $GITHUB_ENV;
135+ echo "ARTIFACT_NAME=devcontainers-cli-${VER}.tgz" >> $GITHUB_ENV;
136+ echo "ARTIFACT_SLUG=devcontainers-cli-${TAG}.tgz" >> $GITHUB_ENV;
148137 else
149138 echo "TEST_STANDALONE_PKG=1" >> $GITHUB_ENV;
139+ echo "ARTIFACT_PATH=dist" >> $GITHUB_ENV;
140+ echo "ARTIFACT_NAME=devcontainer-${{ matrix.os-name }}-x64${{ matrix.exe-suf }}" >> $GITHUB_ENV;
141+ echo "ARTIFACT_SLUG=devcontainer-${{ matrix.os-name }}-x64-${TAG}${{ matrix.exe-suf }}" >> $GITHUB_ENV;
150142 fi
151143 - name : Setup Node.js
152144 uses : actions/setup-node@v3
153145 with :
146+ scope : ' @microsoft'
154147 node-version : ' ${{ matrix.node }}.x'
155148 registry-url : ' https://npm.pkg.github.com'
156- scope : ' @microsoft'
157149 - name : Cache node_modules
158150 uses : actions/cache@v3
159151 with :
@@ -165,12 +157,24 @@ jobs:
165157 - name : Download artifact
166158 uses : actions/download-artifact@v3
167159 with :
168- name : devcontainers-cli-${{ env.TAG }}
160+ name : ${{ env.ARTIFACT_SLUG }}
161+ path : ${{ env.ARTIFACT_PATH }}
162+ - name : Install docker for macOS
163+ if : matrix.os == 'macos'
164+ shell : bash
165+ env :
166+ HOMEBREW_ACCEPT_EULA : Y
167+ HOMEBREW_NO_AUTO_UPDATE : 1
168+ HOMEBREW_NO_INSTALL_CLEANUP : Y
169+ run : |
170+ brew install docker;
171+ colima start;
172+ docker ps -a;
169173 - name : Run Tests
170174 shell : bash
171175 run : |
172176 if [[ "$TEST_STANDALONE_PKG" == "1" ]]; then
173- chmod +x dist/devcontainer-${{ matrix.os-name }}-x64${{ matrix.exe-suf } };
177+ chmod +x ${ARTIFACT_PATH}/${ARTIFACT_NAME };
174178 fi
175179 yarn test-matrix --forbid-only ${{ matrix.mocha-args }};
176180
0 commit comments