name: Installation tests # Declare default permissions as read only. permissions: read-all on: push: branches: - main pull_request: branches: - '**' concurrency: group: installation-tests-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: check-changes: uses: ./.github/workflows/changed-packages.yml with: check-mergeable-state: true installation-test-build: name: Build installation test runs-on: ubuntu-latest needs: check-changes if: ${{ contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Node.js uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: cache: npm node-version: lts/* - name: Install dependencies run: npm ci env: PUPPETEER_SKIP_DOWNLOAD: true - name: Build installation test run: npm run build -w @puppeteer-test/installation - name: Pack installation test run: npm pack -w @puppeteer-test/installation - name: Upload installation test uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: name: installation-test path: puppeteer-test-installation-latest.tgz installation-test: name: Test ${{ matrix.pkg_manager }} installation on ${{ matrix.os }} (${{ matrix.node }}) needs: installation-test-build runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - ubuntu-latest - macos-latest - windows-latest node: - 18 pkg_manager: - npm steps: - name: Download installation test uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: name: installation-test - name: Unpack installation test run: tar -xf puppeteer-test-installation-latest.tgz --strip-components 1 -C . - name: Set up Node.js uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 with: node-version: ${{ matrix.node }} - name: Install dependencies run: ${{ matrix.pkg_manager }} install - name: Test env: PKG_MANAGER: ${{ matrix.pkg_manager }} run: ${{ matrix.pkg_manager }} test installation-test-required: name: '[Required] Installation tests' needs: [check-changes, installation-test] runs-on: ubuntu-latest if: ${{ always() }} steps: - if: ${{ needs.installation-test.result != 'success' && contains(fromJSON(needs.check-changes.outputs.changes), 'puppeteer') }} run: 'exit 1' - run: 'exit 0'