ci: add Arm64 docker builds + add setup-cpp base Docker images + fix vcpkg on Linux Arm64 + update apt for the first install #1690
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
env: | |
NODE_OPTIONS: --enable-source-maps | |
jobs: | |
Build: | |
runs-on: ${{ matrix.os }} | |
name: Build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref || github.ref_name }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "./.nvmrc" | |
- name: Setup Pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install | |
run: | | |
pnpm install | |
- name: Build | |
run: | | |
pnpm build | |
pnpm build.docker-ci | |
- name: Lint | |
run: | | |
pnpm run test.lint | |
- name: Update Dist | |
run: | | |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then | |
if [[ "${{ github.ref_name }}" =~ ^refs/heads/ ]]; then | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add dist/ | |
git commit -m "chore(build): update dist" | |
git push | |
else | |
echo "Skipping push for non-branch commit" | |
fi | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Dist | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: dist | |
path: | | |
./dist | |
./packages/*/dist | |
./dev/docker/__tests__/ | |
retention-days: 1 | |
BuildExecutable: | |
name: Build-Executable-${{ matrix.os }} | |
needs: [Build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2019 | |
- ubuntu-20.04 | |
- macos-13 # x64 | |
- macos-14 # arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "./.nvmrc" | |
- name: Setup Pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Cache node_modules | |
if: ${{ !contains(matrix.os, 'windows') }} | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
D:\.pnpm-store | |
./node_modules | |
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './pnpm-*.yaml') }}" | |
restore-keys: | | |
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-" | |
- name: Install | |
run: | | |
pnpm install | |
# Create self-contained executable that bundles Nodejs | |
- name: Create Executable | |
run: | | |
pnpm run pack.exe | |
- name: Upload Executables | |
uses: actions/upload-artifact@v4 | |
with: | |
name: exe-${{ matrix.os }} | |
path: | | |
./exe | |
retention-days: 7 | |
Test: | |
name: Test-${{ matrix.os }} | |
needs: [Build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2022 | |
- windows-2019 | |
- ubuntu-24.04 | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-15 # arm64 | |
# - macos-15-large # x64 | |
- macos-14 # arm64 | |
# - macos-14-large # x64 | |
# - macos-14-xlarge #arm64 | |
- macos-13 # x64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Download Dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "./.nvmrc" | |
- name: Setup Pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Cache node_modules | |
if: ${{ !contains(matrix.os, 'windows') }} | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
D:\.pnpm-store | |
./node_modules | |
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc', './package.json', './.nvmrc', './pnpm-*.yaml') }}" | |
restore-keys: | | |
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-" | |
- name: Install | |
run: | | |
pnpm install | |
# - name: Setup SSH debugging session | |
# uses: mxschmitt/action-tmate@v3 | |
- name: Tests | |
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }} | |
run: | | |
pnpm run test | |
env: | |
RUNNER_OS_NAME: ${{ matrix.os }} | |
- name: Setup Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Smoke Test Modern Bundle | |
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }} | |
run: | | |
node ./dist/modern/setup-cpp.mjs --help | |
node ./dist/modern/setup-cpp.mjs --gcc true --cmake true | |
env: | |
RUNNER_OS_NAME: ${{ matrix.os }} | |
- name: Setup Node 12 | |
if: ${{ !contains(matrix.os, 'macos-14') && !contains(matrix.os, 'macos-15') }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 12 | |
- name: Smoke Test Legacy Bundle | |
run: | | |
node ./dist/legacy/setup-cpp.js --help | |
node ./dist/legacy/setup-cpp.js --gcc true --cmake true | |
Docker: | |
name: Docker-${{ matrix.container.image }}-${{ matrix.platform }} | |
needs: [Build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04 | |
platform: | |
- linux/amd64 | |
container: | |
- { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-0.46.2" } | |
- { distro: "fedora", image: "setup-cpp-fedora", tag: "40-0.46.2" } | |
- { distro: "arch", image: "setup-cpp-arch", tag: "base-0.46.2" } | |
include: | |
- os: ubuntu-24.04 | |
platform: linux/arm64 | |
container: { distro: "ubuntu", image: "setup-cpp-ubuntu", tag: "22.04-0.46.2" } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Download Dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- name: Set up QEMU | |
if: contains(matrix.platform, 'arm64') | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
image: tonistiigi/binfmt:qemu-v7.0.0 | |
- name: Set up Docker Buildx | |
if: contains(matrix.platform, 'arm64') | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
username: aminya | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build setup-cpp-${{matrix.container.distro }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./dev/docker/ci/${{ matrix.container.distro }}.dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: ${{ matrix.platform }} | |
tags: ${{ matrix.container.image }},aminya/${{ matrix.container.image }}:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}:latest | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
- name: Build setup-cpp-${{matrix.container.distro }}-llvm | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./dev/docker/ci/${{ matrix.container.distro }}-llvm.dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: ${{ matrix.platform }} | |
tags: aminya/${{ matrix.container.image }}-llvm:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-llvm:latest | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
- name: Test LLVM | |
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./dev/docker/examples/${{ matrix.container.distro }}-llvm.dockerfile | |
push: false | |
platforms: ${{ matrix.platform }} | |
tags: aminya/test-${{ matrix.container.image }}-llvm:${{ matrix.container.tag }} | |
- name: Build setup-cpp-${{matrix.container.distro }}-mingw | |
if: ${{ !contains(matrix.container.distro, 'fedora') }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./dev/docker/ci/${{ matrix.container.distro }}-mingw.dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
platforms: ${{ matrix.platform }} | |
tags: aminya/${{ matrix.container.image }}-mingw:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}-mingw:latest | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
- name: Test Mingw | |
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(matrix.container.distro, 'fedora') }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./dev/docker/examples/${{ matrix.container.distro }}-mingw.dockerfile | |
push: false | |
platforms: ${{ matrix.platform }} | |
tags: aminya/test-${{ matrix.container.image }}-mingw:${{ matrix.container.tag }} | |
Release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [Build, BuildExecutable, Test] | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Download Executables | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: exe-* | |
path: ./exe/ | |
merge-multiple: true | |
- name: Chmod executables | |
shell: bash | |
run: | | |
chmod +x -R ./exe/ | |
- name: Download Dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Tar Dist | |
run: | | |
tar -czf modern.tgz ./dist/modern | |
tar -czf legacy.tgz ./dist/legacy | |
ls -R ./dist/ | |
continue-on-error: true | |
- name: Create Release in this repo | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./exe/* | |
modern.tgz | |
legacy.tgz | |
generate_release_notes: true | |
# fail_on_unmatched_files: true |