Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00
setup-cpp/.github/workflows/CI.yml
2022-02-13 20:16:18 -08:00

130 lines
3.3 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- master
- main
- dev
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
- windows-2016
- ubuntu-20.04
- ubuntu-18.04
- macos-11
- macos-10.15
node:
- 14 # installed on the images
pnpm:
- 6
cache_reset_counter:
- 0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Cache
uses: actions/cache@v2
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') }}-${{ matrix.cache_reset_counter }}"
restore-keys: |
"setupcpp-cache-OS:${{ matrix.os }}"
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm }}
- name: Install and build
run: |
pnpm install
# Create self-contained executable that bundles Nodejs
- name: Create Executable
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
run: |
pnpm run pack.exe
- name: Upload Executable
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
uses: actions/upload-artifact@v2
with:
path: |
./exe
./dist
retention-days: 1
# - name: Setup SSH debugging session
# uses: mxschmitt/action-tmate@v3
- name: Test
if: "!contains(github.event.head_commit.message, '[skip ci test]')"
run: |
pnpm run test
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}
Docker:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-20.04
node:
- 14
pnpm:
- 6
cache_reset_counter:
- 0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.pnpm-store
D:\.pnpm-store
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}-${{ matrix.cache_reset_counter }}"
restore-keys: |
"setupcpp-docker-cache-OS:${{ matrix.os }}"
- name: Setup Node
uses: actions/setup-node@v2
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: |
pnpm build.docker
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true