name: Continuous Integration on: push: paths-ignore: - "**.md" - "tools/**" pull_request: paths-ignore: - "**.md" - "tools/**" pull_request_target: paths-ignore: - "**.md" - "tools/**" types: - labeled schedule: - cron: 0 11 * * 1-5 jobs: unlabel: if: ${{ github.event_name == 'pull_request_target' && github.event.label.name == 'full-ci' }} runs-on: ubuntu-latest steps: - run: gh pr edit $PR --repo $REPO --remove-label "full-ci" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR: ${{ github.event.number }} REPO: ${{ github.event.repository.full_name }} build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Setup node uses: actions/setup-node@v2 with: node-version: 14 check-latest: true - name: Store node version variable id: node run: | echo "::set-output name=version::$(node -v)" - name: Cache node_modules uses: actions/cache@v2 id: node_modules with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}-${{ steps.node.outputs.version }} - name: Install dependencies run: npx panva/npm-install-retry if: ${{ steps.node_modules.outputs.cache-hit != 'true' }} - name: Cache dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - run: sed -i -e "s/-i ''/-i/g" package.json - run: sed -i -e "s/gcp/cp/g" package.json - name: Build run: npm run build-all if: ${{ steps.dist.outputs.cache-hit != 'true' }} - run: git reset HEAD --hard test: needs: - build continue-on-error: ${{ matrix.experimental || false }} strategy: fail-fast: false matrix: node-version: - 12.20.0 - 12 - 14.15.0 - 14 - 16.13.0 - 16 include: - experimental: true node-version: '>=17' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Setup node uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} check-latest: true - name: Store node version variable id: node run: | echo "::set-output name=version::$(node -v)" - name: Cache node_modules uses: actions/cache@v2 id: node_modules with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}-${{ steps.node.outputs.version }} - name: Install dependencies run: npx panva/npm-install-retry if: ${{ steps.node_modules.outputs.cache-hit != 'true' }} - name: Load cached dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - run: find test -type f -name '*.mjs' -print0 | xargs -0 sed -i -e "s/await import(/require(/g" if: ${{ startsWith(matrix.node-version, '12') }} - name: Test with Node.js crypto module run: npm run test - name: Test with Node.js crypto module w/ CryptoKey run: npm run test-cryptokey if: ${{ !startsWith(matrix.node-version, '14') && !startsWith(matrix.node-version, '12') }} - name: Test with Node.js Web Cryptography API run: npm run test-webcrypto if: ${{ !startsWith(matrix.node-version, '14') && !startsWith(matrix.node-version, '12') }} - name: Test with Node.js Web API run: npm run test-webapi if: ${{ matrix.experimental }} - run: git reset HEAD --hard test-deno: needs: - build continue-on-error: ${{ matrix.experimental || false }} strategy: fail-fast: false matrix: deno-version: - v1.18.0 - v1 include: - experimental: true deno-version: canary runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - uses: denoland/setup-deno@v1 with: deno-version: ${{ matrix.deno-version }} - name: Load cached dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - name: Test Deno Definitions run: npm run test-deno -- --no-run - name: Test Deno run: npm run test-deno -- --no-check - run: git reset HEAD --hard test-cloudflare: concurrency: test-cloudflare if: ${{ !startsWith(github.event_name, 'pull_request') || (github.event_name == 'pull_request_target' && github.event.label.name == 'full-ci') }} needs: - build runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - uses: denoland/setup-deno@v1 with: deno-version: v1.x - name: Setup node uses: actions/setup-node@v2 with: node-version: 16 - name: Store node version variable id: node run: | echo "::set-output name=version::$(node -v)" - name: Cache node_modules uses: actions/cache@v2 id: node_modules with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}-${{ steps.node.outputs.version }} - name: Install dependencies run: npx panva/npm-install-retry if: ${{ steps.node_modules.outputs.cache-hit != 'true' }} - name: Load cached dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - name: Test Cloudflare Workers run: npm run test-cloudflare-workers env: CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} - run: git reset HEAD --hard test-electron: needs: - build strategy: fail-fast: false matrix: electron-version: - 12.0.0 - latest runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Setup node uses: actions/setup-node@v2 with: node-version: 14 check-latest: true - name: Store node version variable id: node run: | echo "::set-output name=version::$(node -v)" - name: Cache node_modules uses: actions/cache@v2 id: node_modules with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}-${{ steps.node.outputs.version }} - name: Install dependencies run: npx panva/npm-install-retry if: ${{ steps.node_modules.outputs.cache-hit != 'true' }} - name: Load cached dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - name: Install Electron run: npm install --global xvfb-maybe electron@${{ matrix.electron-version }} - name: Test Electron crypto run: xvfb-maybe electron ./test/.electron - run: git reset HEAD --hard test-browsers: concurrency: test-browsers if: ${{ !startsWith(github.event_name, 'pull_request') || (github.event_name == 'pull_request_target' && github.event.label.name == 'full-ci') }} env: BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} needs: - build runs-on: ubuntu-latest steps: - uses: denoland/setup-deno@v1 with: deno-version: v1.x - name: Checkout uses: actions/checkout@v2 - name: Setup node uses: actions/setup-node@v2 with: node-version: 14 - name: Store node version variable id: node run: | echo "::set-output name=version::$(node -v)" - name: Cache node_modules uses: actions/cache@v2 id: node_modules with: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}-${{ steps.node.outputs.version }} - name: Install dependencies run: npx panva/npm-install-retry if: ${{ steps.node_modules.outputs.cache-hit != 'true' }} - name: Load cached dist uses: actions/cache@v2 id: dist with: path: dist key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}-${{ hashFiles('.github/workflows/*.yml') }}-${{ hashFiles('package.json') }} - run: npx retry-cli npm run test-browsers - run: git reset HEAD --hard prepare-release: needs: - test - test-browsers - test-electron - test-deno - test-cloudflare runs-on: ubuntu-latest if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository == 'panva/jose' }} steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 2 - name: Setup node uses: actions/setup-node@v2 with: node-version: 14 - run: node tools/release-notes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}