2021-09-14 14:51:51 +08:00
|
|
|
name: CI
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- main
|
2021-09-18 20:12:22 +08:00
|
|
|
- dev
|
2022-10-20 09:16:32 +08:00
|
|
|
tags:
|
|
|
|
- "*"
|
2021-09-14 14:51:51 +08:00
|
|
|
|
2024-04-01 14:53:54 +08:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-09-14 14:51:51 +08:00
|
|
|
jobs:
|
2023-07-25 04:59:56 +08:00
|
|
|
Build:
|
2024-08-08 07:16:49 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
2023-07-25 04:59:56 +08:00
|
|
|
name: Build
|
2022-11-05 11:20:22 +08:00
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
2021-09-14 14:51:51 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
2024-08-08 07:16:49 +08:00
|
|
|
- ubuntu-24.04
|
2023-04-06 22:40:42 +08:00
|
|
|
node:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 22
|
2023-04-25 04:24:44 +08:00
|
|
|
pnpm:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 9
|
2021-09-14 14:51:51 +08:00
|
|
|
steps:
|
2024-01-21 06:33:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2021-09-14 14:51:51 +08:00
|
|
|
|
|
|
|
- name: Cache
|
2024-01-21 06:33:40 +08:00
|
|
|
uses: actions/cache@v4
|
2021-09-14 14:51:51 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.pnpm-store
|
|
|
|
D:\.pnpm-store
|
2022-08-04 14:09:17 +08:00
|
|
|
key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
2021-09-14 14:51:51 +08:00
|
|
|
restore-keys: |
|
2022-08-04 14:09:17 +08:00
|
|
|
"setupcpp-cache-OS:${{ matrix.os }}-"
|
2021-09-14 14:51:51 +08:00
|
|
|
|
|
|
|
- name: Setup Node
|
2024-01-21 09:02:29 +08:00
|
|
|
uses: actions/setup-node@v4
|
2021-09-14 14:51:51 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
|
|
|
|
|
|
|
- name: Setup Pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: ${{ matrix.pnpm }}
|
|
|
|
|
2023-07-25 05:08:07 +08:00
|
|
|
- name: Install
|
2021-09-14 14:51:51 +08:00
|
|
|
run: |
|
|
|
|
pnpm install
|
2023-07-25 05:08:07 +08:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
pnpm build
|
2024-03-24 15:23:24 +08:00
|
|
|
pnpm build.docker-ci
|
2021-09-14 14:51:51 +08:00
|
|
|
|
2023-07-25 05:28:48 +08:00
|
|
|
- name: Lint
|
|
|
|
run: |
|
|
|
|
pnpm run test.lint
|
|
|
|
|
2024-04-01 14:40:44 +08:00
|
|
|
- name: Validate Dist
|
|
|
|
run: |
|
|
|
|
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
|
|
|
echo "Detected uncommitted changes after build. See status below:"
|
2024-04-03 16:20:06 +08:00
|
|
|
git diff --ignore-space-at-eol --text dist/ ':(exclude)*.js.map'
|
2024-04-01 14:40:44 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
- name: Upload Dist
|
|
|
|
uses: actions/upload-artifact@v3
|
2024-08-08 02:23:38 +08:00
|
|
|
if: always()
|
2023-07-25 04:59:56 +08:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: |
|
|
|
|
./dist
|
2023-07-25 05:18:02 +08:00
|
|
|
./packages/*/dist
|
2023-07-25 04:59:56 +08:00
|
|
|
./dev/docker/__tests__/
|
|
|
|
retention-days: 1
|
2022-10-20 09:28:31 +08:00
|
|
|
|
2023-07-25 05:08:07 +08:00
|
|
|
BuildExecutable:
|
|
|
|
name: Build-Executable-${{ matrix.os }}
|
2023-07-25 04:59:56 +08:00
|
|
|
needs: [Build]
|
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- windows-2022
|
2024-08-08 07:16:49 +08:00
|
|
|
- ubuntu-24.04
|
2024-04-03 16:03:49 +08:00
|
|
|
- macos-13
|
2023-07-25 04:59:56 +08:00
|
|
|
- macos-12
|
|
|
|
node:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 22
|
2023-07-25 04:59:56 +08:00
|
|
|
pnpm:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 9
|
2023-07-25 04:59:56 +08:00
|
|
|
steps:
|
2024-01-21 06:33:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-25 04:59:56 +08:00
|
|
|
|
|
|
|
- name: Download Artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
|
|
|
|
- name: Setup Node
|
2024-01-21 09:02:29 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-07-25 04:59:56 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
|
|
|
|
|
|
|
- name: Setup Pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: ${{ matrix.pnpm }}
|
2022-10-20 09:28:31 +08:00
|
|
|
|
2023-07-25 05:08:07 +08:00
|
|
|
- name: Cache node_modules
|
2024-01-21 06:33:40 +08:00
|
|
|
uses: actions/cache@v4
|
2023-07-25 05:08:07 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.pnpm-store
|
|
|
|
D:\.pnpm-store
|
|
|
|
./node_modules
|
|
|
|
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
|
|
|
restore-keys: |
|
|
|
|
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
run: |
|
|
|
|
pnpm install
|
|
|
|
|
2023-04-25 04:50:53 +08:00
|
|
|
# Create self-contained executable that bundles Nodejs
|
|
|
|
- name: Create Executable
|
|
|
|
run: |
|
|
|
|
pnpm run pack.exe
|
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
- name: Upload Executables
|
2023-04-25 04:50:53 +08:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-07-25 04:59:56 +08:00
|
|
|
name: exe
|
2023-04-25 04:50:53 +08:00
|
|
|
path: |
|
|
|
|
./exe
|
|
|
|
retention-days: 1
|
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
Test:
|
2023-07-25 05:08:07 +08:00
|
|
|
name: Test-${{ matrix.os }}
|
2023-09-02 05:48:28 +08:00
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
2023-07-25 04:59:56 +08:00
|
|
|
needs: [Build]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- windows-2022
|
|
|
|
- windows-2019
|
2024-08-08 07:16:49 +08:00
|
|
|
- ubuntu-24.04
|
2023-07-25 04:59:56 +08:00
|
|
|
- ubuntu-22.04
|
|
|
|
- ubuntu-20.04
|
2024-02-17 06:20:27 +08:00
|
|
|
- macos-13
|
2023-07-25 04:59:56 +08:00
|
|
|
- macos-12
|
|
|
|
node:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 22
|
2023-07-25 04:59:56 +08:00
|
|
|
pnpm:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 9
|
2023-07-25 04:59:56 +08:00
|
|
|
steps:
|
2024-01-21 06:33:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-25 04:59:56 +08:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: Download Dist
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
|
|
|
|
- name: Setup Node
|
2024-01-21 09:02:29 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-07-25 04:59:56 +08:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
|
|
|
|
|
|
|
- name: Setup Pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: ${{ matrix.pnpm }}
|
|
|
|
|
2023-07-25 05:08:07 +08:00
|
|
|
- name: Cache node_modules
|
2024-01-21 06:33:40 +08:00
|
|
|
uses: actions/cache@v4
|
2023-07-25 05:08:07 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.pnpm-store
|
|
|
|
D:\.pnpm-store
|
|
|
|
./node_modules
|
|
|
|
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
|
|
|
restore-keys: |
|
|
|
|
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
|
2023-07-25 04:59:56 +08:00
|
|
|
|
|
|
|
- name: Install
|
|
|
|
run: |
|
|
|
|
pnpm install
|
|
|
|
|
2023-07-25 05:08:07 +08:00
|
|
|
# - name: Setup SSH debugging session
|
|
|
|
# uses: mxschmitt/action-tmate@v3
|
|
|
|
|
2023-07-25 05:28:48 +08:00
|
|
|
- name: Tests
|
2023-09-02 05:48:28 +08:00
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
|
2023-07-25 04:59:56 +08:00
|
|
|
run: |
|
|
|
|
pnpm run test
|
2023-09-02 02:23:25 +08:00
|
|
|
env:
|
|
|
|
RUNNER_OS_NAME: ${{ matrix.os }}
|
2023-07-25 04:59:56 +08:00
|
|
|
|
2023-04-25 04:49:29 +08:00
|
|
|
- name: Setup Node 12
|
2024-01-21 09:02:29 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-04-25 04:49:29 +08:00
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
- name: Smoke Test Node 12
|
|
|
|
run: |
|
2023-07-16 06:41:58 +08:00
|
|
|
node ./dist/legacy/setup-cpp.js --help
|
2023-04-25 04:49:29 +08:00
|
|
|
|
|
|
|
- name: Setup Node 16
|
2024-01-21 09:02:29 +08:00
|
|
|
uses: actions/setup-node@v4
|
2023-04-25 04:49:29 +08:00
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
- name: Smoke Test Node 16
|
|
|
|
run: |
|
2023-07-16 07:08:05 +08:00
|
|
|
node ./dist/actions/setup-cpp.js --help
|
2023-04-25 04:49:29 +08:00
|
|
|
|
2021-09-18 20:12:22 +08:00
|
|
|
Docker:
|
2024-03-24 15:33:04 +08:00
|
|
|
name: Docker-${{ matrix.container.image }}
|
2023-09-02 05:48:28 +08:00
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
2023-07-25 04:59:56 +08:00
|
|
|
needs: [Build]
|
2021-09-18 20:12:22 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2022-06-30 10:12:35 +08:00
|
|
|
fail-fast: false
|
2021-09-18 20:12:22 +08:00
|
|
|
matrix:
|
|
|
|
os:
|
2024-08-08 07:16:49 +08:00
|
|
|
- ubuntu-24.04
|
2023-07-16 06:05:41 +08:00
|
|
|
node:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 22
|
2023-07-16 06:05:41 +08:00
|
|
|
pnpm:
|
2024-08-08 02:35:04 +08:00
|
|
|
- 9
|
2022-02-15 17:23:01 +08:00
|
|
|
container:
|
2024-03-24 15:52:14 +08:00
|
|
|
- { file: "ubuntu-llvm.dockerfile", image: "setup-cpp-ubuntu-llvm", tag: "22.04-0.37.0" }
|
|
|
|
- { file: "fedora-llvm.dockerfile", image: "setup-cpp-fedora-llvm", tag: "40-0.37.0" }
|
|
|
|
- { file: "arch-llvm.dockerfile", image: "setup-cpp-arch-llvm", tag: "base-0.37.0" }
|
|
|
|
- { file: "ubuntu-mingw.dockerfile", image: "setup-cpp-ubuntu-mingw", tag: "22.04-0.37.0" }
|
|
|
|
# - { file: "fedora-mingw.dockerfile", image: "setup-cpp-fedora-mingw", tag: "40-0.37.0" }
|
|
|
|
# - { file: "arch-mingw.dockerfile", image: "setup-cpp-arch-mingw", tag: "base-0.37.0" }
|
2021-09-18 20:12:22 +08:00
|
|
|
steps:
|
2024-01-21 06:33:44 +08:00
|
|
|
- uses: actions/checkout@v4
|
2021-09-18 20:12:22 +08:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
- name: Download Dist
|
|
|
|
uses: actions/download-artifact@v3
|
2023-07-16 06:05:41 +08:00
|
|
|
with:
|
2023-07-25 04:59:56 +08:00
|
|
|
name: dist
|
2023-07-16 06:05:41 +08:00
|
|
|
|
2024-03-24 15:20:20 +08:00
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
|
|
with:
|
2024-04-01 13:44:39 +08:00
|
|
|
username: aminya
|
2024-03-24 15:20:20 +08:00
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push
|
2024-06-22 10:02:20 +08:00
|
|
|
uses: docker/build-push-action@v6
|
2024-03-24 15:20:20 +08:00
|
|
|
with:
|
|
|
|
context: .
|
2024-03-24 15:23:24 +08:00
|
|
|
file: ./dev/docker/ci/${{ matrix.container.file }}
|
2024-03-24 15:20:20 +08:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2024-04-01 13:44:39 +08:00
|
|
|
tags: aminya/${{ matrix.container.image }}:${{ matrix.container.tag }},aminya/${{ matrix.container.image }}:latest
|
2024-03-24 15:52:14 +08:00
|
|
|
|
2024-03-24 15:23:24 +08:00
|
|
|
- name: Test
|
2024-06-22 10:02:20 +08:00
|
|
|
uses: docker/build-push-action@v6
|
2024-03-24 15:23:24 +08:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./dev/docker/examples/${{ matrix.container.file }}
|
|
|
|
push: false
|
2024-04-01 13:44:39 +08:00
|
|
|
tags: aminya/test-${{ matrix.container.image }}:${{ matrix.container.tag }}
|
2024-03-24 15:23:24 +08:00
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
Release:
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2023-07-25 05:08:07 +08:00
|
|
|
needs: [Build, BuildExecutable, Test, Docker]
|
2024-08-08 07:16:49 +08:00
|
|
|
runs-on: ubuntu-24.04
|
2023-07-25 04:59:56 +08:00
|
|
|
steps:
|
|
|
|
- name: Download All Artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
|
|
|
- name: Place Artifacts
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-09-02 06:04:09 +08:00
|
|
|
mv -v ./dist/ ./dist-artifacts
|
|
|
|
mv -v ./dist-artifacts/* ./
|
|
|
|
|
2023-07-25 04:59:56 +08:00
|
|
|
chmod +x -R ./exe/
|
|
|
|
|
|
|
|
- name: Draft the release
|
|
|
|
uses: meeDamian/github-release@2.0
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
gzip: folders
|
|
|
|
draft: true
|
|
|
|
files: >
|
|
|
|
./exe/setup-cpp-x64-windows.exe
|
|
|
|
./exe/setup-cpp-x64-linux
|
|
|
|
./exe/setup-cpp-x64-macos
|
|
|
|
./dist/legacy/
|
|
|
|
./dist/actions/
|
|
|
|
./dist/modern/
|