mirror of https://github.com/aminya/setup-cpp
161 lines
4.3 KiB
YAML
161 lines
4.3 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:
|
|
- 18
|
|
pnpm:
|
|
- 8
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.pnpm-store
|
|
D:\.pnpm-store
|
|
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/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
|
|
|
|
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/node12/setup-cpp.js
|
|
./dist/node12/setup-cpp.js.map
|
|
./dist/node12/ # TODO: deprecate node12
|
|
./dist/node16/
|
|
./dist/node18/
|
|
|
|
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
|
|
container:
|
|
- "arch_node.dockerfile"
|
|
- "fedora_node.dockerfile"
|
|
- "ubuntu_20.04_node_legacy.dockerfile"
|
|
- "ubuntu_20.04_node.dockerfile"
|
|
- "ubuntu_node_legacy.dockerfile"
|
|
- "ubuntu_node.dockerfile"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.pnpm-store
|
|
D:\.pnpm-store
|
|
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
|
|
restore-keys: |
|
|
"setupcpp-docker-cache-OS:${{ matrix.os }}"
|
|
|
|
- name: Build
|
|
id: docker_build
|
|
run: |
|
|
docker build -f ./dev/docker/${{ matrix.container }} -t setup-cpp .
|