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 - ubuntu-18.04 - macos-12 - macos-11 node: - 16 pnpm: - 7 cache_reset_counter: - 0 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 continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }} # 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 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_windows.exe ./exe/setup_cpp_linux ./exe/setup_cpp_mac ./dist/node12/setup_cpp.js ./dist/node12/setup_cpp.js.map ./dist/node12/ ./dist/node16/ Docker: if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - ubuntu-20.04 container: - "ubuntu_node.dockerfile" - "ubuntu_node_16.dockerfile" - "ubuntu_node.mingw.dockerfile" - "ubuntu_22.04_node.dockerfile" - "ubuntu_20.04_node.dockerfile" - "arch_node.dockerfile" - "arch_node.mingw.dockerfile" - "fedora_node.dockerfile" - "fedora_node.mingw.dockerfile" node: - 14 pnpm: - 6 cache_reset_counter: - 0 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 }}-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@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 ./dev/docker/${{ matrix.container }} -t setup_cpp .