Skip to content

Update workflows to package and release standalone binaries #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c828996
add package-standalone npm script to run vercel/pkg on the minified b…
trxcllnt Dec 23, 2022
9829ed9
update yarn.lock
trxcllnt Dec 23, 2022
dea73bc
copy scripts/updateUID.Dockerfile into standalone packages
trxcllnt Jan 3, 2023
e32c3b5
update tests to optionally execute the standalone binary instead of t…
trxcllnt Jan 3, 2023
7b16b80
update dev-containers.yml workflow to build, upload, and test the sta…
trxcllnt Jan 3, 2023
fb00be8
setup QEMU
trxcllnt Jan 3, 2023
4f7a744
fix typos
trxcllnt Jan 3, 2023
7716f15
run standalone binary tests on windows
trxcllnt Jan 3, 2023
4ab41ea
separate scripts for building each os/arch combo
trxcllnt Jan 4, 2023
873be77
update yarn.lock
trxcllnt Jan 4, 2023
6a4a539
update actions to build macos binaries, download artifact for testing…
trxcllnt Jan 4, 2023
7f6d4ae
build the pkgs on separate OS's
trxcllnt Jan 4, 2023
97c6f70
update registryCompatibilityOCI.test.ts
trxcllnt Jan 4, 2023
817a9b4
add package-standalone npm script to run vercel/pkg on the minified b…
trxcllnt Dec 23, 2022
8d4beea
update yarn.lock
trxcllnt Dec 23, 2022
dc37f6d
copy scripts/updateUID.Dockerfile into standalone packages
trxcllnt Jan 3, 2023
fc745df
update tests to optionally execute the standalone binary instead of t…
trxcllnt Jan 3, 2023
3210199
update dev-containers.yml workflow to build, upload, and test the sta…
trxcllnt Jan 3, 2023
3ec97a3
setup QEMU
trxcllnt Jan 3, 2023
a57398d
fix typos
trxcllnt Jan 3, 2023
9d51488
run standalone binary tests on windows
trxcllnt Jan 3, 2023
6177f68
separate scripts for building each os/arch combo
trxcllnt Jan 4, 2023
fd39253
update yarn.lock
trxcllnt Jan 4, 2023
1b5907d
update registryCompatibilityOCI.test.ts
trxcllnt Jan 4, 2023
1a8bc5a
Merge branch 'main' of github.com:devcontainers/cli into fea/pkg
trxcllnt Jan 21, 2023
6f4afce
Merge branch 'fea/pkg' into fea/pkg-workflows
trxcllnt Jan 21, 2023
2fb68ae
silence buffer ctor deprecation warnings
trxcllnt Jan 21, 2023
b146bb6
publish github releases with artifacts
trxcllnt Jan 22, 2023
9ff701f
build on older OS versions
trxcllnt Jan 24, 2023
6a1ecfc
cache bust on os change
trxcllnt Jan 24, 2023
6131899
Merge branch 'main' into fea/pkg
joshspicer Feb 7, 2023
a62cd9f
Merge branch 'fea/pkg' into fea/pkg-workflows
trxcllnt Feb 7, 2023
9ae26cb
ensure ts-node doesn't attempt to transpile node-pty tests
trxcllnt Feb 7, 2023
5c70bfa
Merge branch 'fea/pkg' into fea/pkg-workflows
trxcllnt Feb 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build-chat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ on:

jobs:
main:
if: github.repository == 'devcontainers/cli'
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: "microsoft/vscode-github-triage-actions"
persist-credentials: false
path: ./actions
- name: Install Actions
run: npm install --production --prefix ./actions
Expand Down
222 changes: 179 additions & 43 deletions .github/workflows/dev-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,78 +8,214 @@ on:
branches:
- '**'

concurrency:
group: test-${{ github.event_name }}-from-${{ github.ref_name }}
cancel-in-progress: true

jobs:
changed:
name: Check for changed files
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changes.outputs.any_changed }}
any_deleted: ${{ steps.changes.outputs.any_deleted }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Check if source files changed
id: changes
uses: tj-actions/changed-files@v35.4.4
with:
files: |
*.js
*.json
yarn.lock
package.json
.github/workflows/dev-containers.yml
src/**
build/**
scripts/**
- name: Report changes
shell: bash
run: |
echo '${{ toJSON(steps.changes.outputs) }}'

cli:
name: CLI
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, pkg: node, os-name: linux, node: 16 }
- { os: ubuntu-20.04, pkg: standalone, os-name: linux, node: 16 }
- { os: macos-11, pkg: standalone, os-name: macos, node: 16 }
- { os: windows-2019, pkg: standalone, os-name: win, node: 16, exe-suf: '.exe' }

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Env
shell: bash
run: |
VER=$(cat package.json | jq -r '.version');
TAG=${VER}-${GITHUB_SHA:0:8};
echo "VER=${VER}" >> $GITHUB_ENV;
echo "TAG=${TAG}" >> $GITHUB_ENV;
if [[ "${{ matrix.pkg }}" == "node" ]]; then
echo "PKG_NPM_SCRIPT=package" >> $GITHUB_ENV;
echo "ARTIFACT_SLUG=devcontainers-cli-${TAG}.tgz" >> $GITHUB_ENV;
echo "ARTIFACT_PATH=devcontainers-cli-${VER}.tgz" >> $GITHUB_ENV;
else
echo "PKG_NPM_SCRIPT=package-standalone-${{ matrix.os-name }}-x64" >> $GITHUB_ENV;
echo "ARTIFACT_SLUG=devcontainer-${{ matrix.os-name }}-x64-${TAG}${{ matrix.exe-suf }}" >> $GITHUB_ENV;
echo "ARTIFACT_PATH=dist/devcontainer-${{ matrix.os-name }}-x64${{ matrix.exe-suf }}" >> $GITHUB_ENV;
fi
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
node-version: '${{ matrix.node }}.x'
registry-url: 'https://npm.pkg.github.com'
- name: Cache node_modules
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-${{ env.VER }}-node${{ matrix.node }}-node_modules-${{ hashFiles('**/yarn.lock', '**/package.json') }}
path: node_modules
- name: Install Dependencies
shell: bash
run: yarn install --frozen-lockfile
- name: Type-Check
- name: Type Check
if: matrix.pkg == 'node'
shell: bash
run: yarn type-check
- name: Lint
if: matrix.pkg == 'node'
shell: bash
run: yarn lint
- name: Package
run: yarn package
- name: TGZ name
run: |
VERSION=$(jq -r '.version' < package.json)
echo "TGZ=devcontainers-cli-${VERSION}.tgz" | tee -a $GITHUB_ENV
echo "TGZ_UPLOAD=devcontainers-cli-${VERSION}-${GITHUB_SHA:0:8}.tgz" | tee -a $GITHUB_ENV
- name: Store TGZ
uses: actions/upload-artifact@v2
shell: bash
run: yarn ${{ env.PKG_NPM_SCRIPT }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.TGZ_UPLOAD }}
path: ${{ env.TGZ }}
name: ${{ env.ARTIFACT_SLUG }}
path: ${{ env.ARTIFACT_PATH }}

tests-matrix:
name: Tests Matrix
runs-on: ubuntu-latest
name: Test
needs: [changed, cli]
if: needs.changed.outputs.any_changed == 'true' || needs.changed.outputs.any_deleted == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
mocha-args: [
"src/test/container-features/e2e.test.ts",
"src/test/container-features/featuresCLICommands.test.ts",
"src/test/container-features/containerFeaturesOrder.test.ts",
"src/test/cli.build.test.ts",
"src/test/cli.exec.buildKit.1.test.ts",
"src/test/cli.exec.buildKit.2.test.ts",
"src/test/cli.exec.nonBuildKit.1.test.ts",
"src/test/cli.exec.nonBuildKit.2.test.ts",
"src/test/cli.test.ts",
"src/test/cli.up.test.ts",
"src/test/container-features/containerFeaturesOCIPush.test.ts",
"src/test/container-features/registryCompatibilityOCI.test.ts",
os: [ubuntu-20.04]
pkg: [node]
node: [16]
mocha-args:
- src/test/container-features/e2e.test.ts
- src/test/container-features/featuresCLICommands.test.ts
- src/test/container-features/containerFeaturesOrder.test.ts
- src/test/cli.build.test.ts
- src/test/cli.exec.buildKit.1.test.ts
- src/test/cli.exec.buildKit.2.test.ts
- src/test/cli.exec.nonBuildKit.1.test.ts
- src/test/cli.exec.nonBuildKit.2.test.ts
- src/test/cli.test.ts
- src/test/cli.up.test.ts
- src/test/container-features/containerFeaturesOCIPush.test.ts
- src/test/container-features/registryCompatibilityOCI.test.ts
# Run all except the above:
"--exclude src/test/container-features/registryCompatibilityOCI.test.ts --exclude src/test/container-features/containerFeaturesOCIPush.test.ts --exclude src/test/container-features/e2e.test.ts --exclude src/test/container-features/featuresCLICommands.test.ts --exclude src/test/container-features/containerFeaturesOrder.test.ts --exclude src/test/cli.build.test.ts --exclude src/test/cli.exec.buildKit.1.test.ts --exclude src/test/cli.exec.buildKit.2.test.ts --exclude src/test/cli.exec.nonBuildKit.1.test.ts --exclude src/test/cli.exec.nonBuildKit.2.test.ts --exclude src/test/cli.test.ts --exclude src/test/cli.up.test.ts 'src/test/**/*.test.ts'",
]
- "--exclude src/test/container-features/registryCompatibilityOCI.test.ts \
--exclude src/test/container-features/containerFeaturesOCIPush.test.ts \
--exclude src/test/container-features/e2e.test.ts \
--exclude src/test/container-features/featuresCLICommands.test.ts \
--exclude src/test/container-features/containerFeaturesOrder.test.ts \
--exclude src/test/cli.build.test.ts \
--exclude src/test/cli.exec.buildKit.1.test.ts \
--exclude src/test/cli.exec.buildKit.2.test.ts \
--exclude src/test/cli.exec.nonBuildKit.1.test.ts \
--exclude src/test/cli.exec.nonBuildKit.2.test.ts \
--exclude src/test/cli.test.ts \
--exclude src/test/cli.up.test.ts \
'src/test/**/*.test.ts'"
include:
- { os: ubuntu-20.04, pkg: standalone, node: 16, os-name: linux, mocha-args: 'src/test/cli.exec.{buildKit,nonBuildKit}.*.test.ts' }
- { os: ubuntu-20.04, pkg: standalone, node: 16, os-name: linux, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts' }
- { os: macos-11, pkg: standalone, node: 16, os-name: macos, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts' }
- { os: windows-2019, pkg: standalone, node: 16, os-name: win, mocha-args: 'src/test/container-features/{containerFeaturesOCI,generateFeaturesConfig}.test.ts', exe-suf: '.exe' }
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Env
shell: bash
run: |
VER=$(cat package.json | jq -r '.version');
TAG=${VER}-${GITHUB_SHA:0:8};
echo "VER=${VER}" >> $GITHUB_ENV;
echo "TAG=${TAG}" >> $GITHUB_ENV;
if [[ "${{ matrix.pkg }}" == "node" ]]; then
echo "TEST_STANDALONE_PKG=0" >> $GITHUB_ENV;
echo "ARTIFACT_PATH=." >> $GITHUB_ENV;
echo "ARTIFACT_NAME=devcontainers-cli-${VER}.tgz" >> $GITHUB_ENV;
echo "ARTIFACT_SLUG=devcontainers-cli-${TAG}.tgz" >> $GITHUB_ENV;
else
echo "TEST_STANDALONE_PKG=1" >> $GITHUB_ENV;
echo "ARTIFACT_PATH=dist" >> $GITHUB_ENV;
echo "ARTIFACT_NAME=devcontainer-${{ matrix.os-name }}-x64${{ matrix.exe-suf }}" >> $GITHUB_ENV;
echo "ARTIFACT_SLUG=devcontainer-${{ matrix.os-name }}-x64-${TAG}${{ matrix.exe-suf }}" >> $GITHUB_ENV;
fi
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@microsoft'
node-version: '${{ matrix.node }}.x'
registry-url: 'https://npm.pkg.github.com'
- name: Cache node_modules
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-${{ env.VER }}-node${{ matrix.node }}-node_modules-${{ hashFiles('**/yarn.lock', '**/package.json') }}
path: node_modules
- name: Install Dependencies
shell: bash
run: yarn install --frozen-lockfile
- name: Type-Check
run: yarn type-check
- name: Package
run: yarn package
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_SLUG }}
path: ${{ env.ARTIFACT_PATH }}
- name: Install docker for macOS
if: startsWith(matrix.os, 'macos')
shell: bash
env:
HOMEBREW_ACCEPT_EULA: Y
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: Y
run: |
brew install docker;
colima start;
docker ps -a;
- name: Run Tests
run: yarn test-matrix --forbid-only ${{ matrix.mocha-args }}
shell: bash
env:
NODE_NO_WARNINGS: ${{ env.TEST_STANDALONE_PKG }}
run: |
if [[ "$TEST_STANDALONE_PKG" == "1" ]]; then
chmod +x ${ARTIFACT_PATH}/${ARTIFACT_NAME};
fi
yarn test-matrix --forbid-only ${{ matrix.mocha-args }};

tests:
name: Tests
needs: tests-matrix
runs-on: ubuntu-latest
steps:
- name: Done
run: echo Test Matrix done.
shell: bash
run: echo "Test Matrix done."
Loading