mirror of https://github.com/aminya/setup-cpp
178 lines
4.6 KiB
YAML
178 lines
4.6 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
- dev
|
|
tags:
|
|
- "*"
|
|
|
|
jobs:
|
|
Test:
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- windows-2022
|
|
- windows-2019
|
|
- ubuntu-22.04
|
|
- ubuntu-20.04
|
|
- macos-12
|
|
- macos-11
|
|
node:
|
|
- 20
|
|
pnpm:
|
|
- 8
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.pnpm-store
|
|
D:\.pnpm-store
|
|
./node_modules
|
|
key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
|
restore-keys: |
|
|
"setupcpp-cache-OS:${{ matrix.os }}-"
|
|
|
|
- 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
|
|
|
|
# - name: Setup SSH debugging session
|
|
# uses: mxschmitt/action-tmate@v3
|
|
|
|
- name: Test
|
|
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
|
|
run: |
|
|
pnpm run test
|
|
|
|
# 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
|
|
|
|
- name: Setup Node 12
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 12
|
|
- name: Smoke Test Node 12
|
|
run: |
|
|
node ./dist/legacy/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
|
|
|
|
Release:
|
|
needs: Test
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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
|
|
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/setup-cpp.js
|
|
./dist/legacy/setup-cpp.js.map
|
|
./dist/legacy/
|
|
./dist/node16/
|
|
./dist/node20/
|
|
|
|
Docker:
|
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-22.04
|
|
node:
|
|
- 20
|
|
pnpm:
|
|
- 8
|
|
container:
|
|
- "./dev/docker/__tests__/arch.dockerfile"
|
|
- "./dev/docker/__tests__/fedora.dockerfile"
|
|
- "./dev/docker/__tests__/ubuntu.dockerfile"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.pnpm-store
|
|
D:\.pnpm-store
|
|
./node_modules
|
|
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
|
restore-keys: |
|
|
"setupcpp-docker-cache-OS:${{ matrix.os }}"
|
|
|
|
- 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
|
|
|
|
- name: Build
|
|
id: docker_build
|
|
run: |
|
|
docker build -f ${{ matrix.container }} -t setup-cpp .
|