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
|
|
|
|
|
|
|
jobs:
|
|
|
|
Test:
|
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
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
2022-02-02 10:28:44 +08:00
|
|
|
- windows-2022
|
2021-09-14 14:51:51 +08:00
|
|
|
- windows-2019
|
2022-07-22 15:20:33 +08:00
|
|
|
- ubuntu-22.04
|
2021-09-14 14:51:51 +08:00
|
|
|
- ubuntu-20.04
|
2022-07-27 15:55:14 +08:00
|
|
|
- macos-12
|
2022-02-14 11:41:23 +08:00
|
|
|
- macos-11
|
2023-04-06 22:40:42 +08:00
|
|
|
node:
|
|
|
|
- 18
|
2023-04-25 04:24:44 +08:00
|
|
|
pnpm:
|
|
|
|
- 8
|
2021-09-14 14:51:51 +08:00
|
|
|
steps:
|
2022-08-22 15:00:57 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-09-15 04:23:45 +08:00
|
|
|
with:
|
|
|
|
submodules: true
|
2021-09-14 14:51:51 +08:00
|
|
|
|
|
|
|
- name: Cache
|
2022-08-22 15:00:57 +08:00
|
|
|
uses: actions/cache@v3
|
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
|
2022-08-22 15:00:57 +08:00
|
|
|
uses: actions/setup-node@v3
|
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 }}
|
|
|
|
|
|
|
|
- name: Install and build
|
|
|
|
run: |
|
|
|
|
pnpm install
|
|
|
|
|
2022-10-20 09:28:31 +08:00
|
|
|
# - name: Setup SSH debugging session
|
|
|
|
# uses: mxschmitt/action-tmate@v3
|
|
|
|
|
|
|
|
- name: Test
|
2023-04-25 04:49:29 +08:00
|
|
|
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
|
2022-10-20 09:28:31 +08:00
|
|
|
run: |
|
|
|
|
pnpm run test
|
|
|
|
|
2023-04-25 04:50:53 +08:00
|
|
|
# Create self-contained executable that bundles Nodejs
|
|
|
|
- name: Create Executable
|
|
|
|
if: "${{ contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}"
|
|
|
|
run: |
|
|
|
|
pnpm run pack.exe
|
|
|
|
|
|
|
|
- name: Upload Artifacts
|
|
|
|
if: ${{ (startsWith(github.ref, 'refs/tags/')) && contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
./exe
|
|
|
|
./dist
|
|
|
|
retention-days: 1
|
|
|
|
|
2023-04-25 04:49:29 +08:00
|
|
|
- name: Setup Node 12
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
- name: Smoke Test Node 12
|
|
|
|
run: |
|
|
|
|
node ./dist/node12/setup-cpp.js --help
|
|
|
|
|
|
|
|
- name: Setup Node 16
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
- name: Smoke Test Node 16
|
|
|
|
run: |
|
|
|
|
node ./dist/node16/setup-cpp.js --help
|
|
|
|
|
2022-10-20 09:28:31 +08:00
|
|
|
Release:
|
|
|
|
needs: Test
|
2022-10-20 10:13:45 +08:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2022-10-20 09:28:31 +08:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: Download Artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
|
|
|
- name: Place Artifacts
|
|
|
|
run: |
|
|
|
|
mv -v artifact/* ./
|
|
|
|
chmod +x -R ./exe/
|
|
|
|
|
|
|
|
- name: Draft the release
|
2022-10-20 09:16:32 +08:00
|
|
|
uses: meeDamian/github-release@2.0
|
2021-09-15 14:29:57 +08:00
|
|
|
with:
|
2022-10-20 09:16:32 +08:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
gzip: folders
|
|
|
|
draft: true
|
|
|
|
files: >
|
2023-01-18 13:50:44 +08:00
|
|
|
./exe/setup-cpp-x64-windows.exe
|
|
|
|
./exe/setup-cpp-x64-linux
|
|
|
|
./exe/setup-cpp-x64-macos
|
2023-04-17 17:14:02 +08:00
|
|
|
./dist/node12/setup-cpp.js
|
|
|
|
./dist/node12/setup-cpp.js.map
|
2023-04-06 20:29:38 +08:00
|
|
|
./dist/node12/ # TODO: deprecate node12
|
2022-10-20 09:16:32 +08:00
|
|
|
./dist/node16/
|
2023-04-06 20:29:38 +08:00
|
|
|
./dist/node18/
|
2021-09-18 20:12:22 +08:00
|
|
|
|
|
|
|
Docker:
|
2023-01-18 04:15:33 +08:00
|
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
|
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:
|
2023-04-06 20:29:38 +08:00
|
|
|
- ubuntu-22.04
|
2023-07-16 06:05:41 +08:00
|
|
|
node:
|
|
|
|
- 18
|
|
|
|
pnpm:
|
|
|
|
- 8
|
2022-02-15 17:23:01 +08:00
|
|
|
container:
|
2023-07-16 06:05:41 +08:00
|
|
|
- "./dev/docker/__tests__/arch.dockerfile"
|
|
|
|
- "./dev/docker/__tests__/fedora.dockerfile"
|
|
|
|
- "./dev/docker/__tests__/ubuntu.dockerfile"
|
2021-09-18 20:12:22 +08:00
|
|
|
steps:
|
2022-08-22 15:00:57 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-09-18 20:12:22 +08:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: Cache
|
2022-08-22 15:00:57 +08:00
|
|
|
uses: actions/cache@v3
|
2021-09-18 20:12:22 +08:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.pnpm-store
|
|
|
|
D:\.pnpm-store
|
2023-04-25 04:49:29 +08:00
|
|
|
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
2021-09-18 20:12:22 +08:00
|
|
|
restore-keys: |
|
|
|
|
"setupcpp-docker-cache-OS:${{ matrix.os }}"
|
|
|
|
|
2023-07-16 06:05:41 +08:00
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
|
|
|
|
|
|
|
- name: Setup Pnpm
|
|
|
|
uses: pnpm/action-setup@v2
|
|
|
|
with:
|
|
|
|
version: ${{ matrix.pnpm }}
|
|
|
|
|
|
|
|
- name: Install and build
|
|
|
|
run: |
|
|
|
|
pnpm install
|
|
|
|
|
2021-09-18 20:12:22 +08:00
|
|
|
- name: Build
|
|
|
|
id: docker_build
|
|
|
|
run: |
|
2023-07-16 06:05:41 +08:00
|
|
|
docker build -f ${{ matrix.container }} -t setup-cpp .
|