diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4d35c8236d3..00000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,88 +0,0 @@ -version: 2 - -jobs: - analysis: - docker: - - image: rollupcabal/circleci-node-base:latest - steps: - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Installing Dependencies - command: npm ci --ignore-scripts - - run: - name: Running linting - command: npm run ci:lint - - run: - name: Running NPM Security Audit - command: npm run security - - save_cache: - key: dependency-cache-{{ checksum "package-lock.json" }} - paths: - - ./node_modules - node-v10-latest: - docker: - - image: rollupcabal/circleci-node-v10:latest - steps: - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Running tests - command: npm run ci:test - node-v12-latest: - docker: - - image: rollupcabal/circleci-node-v12:latest - steps: - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Running tests - command: npm run ci:test:only - - store_artifacts: - name: Storing browser build for REPL - path: /home/circleci/project/dist/rollup.browser.js - destination: rollup.browser.js - - run: - name: Post REPL comment - command: ./scripts/post-comment.js - node-v14-latest: - docker: - - image: rollupcabal/circleci-node-v14:latest - steps: - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package-lock.json" }} - - run: - name: Running tests with coverage - command: npm run ci:coverage - - -workflows: - version: 2 - validate-test: - jobs: - - analysis: - filters: - tags: - only: /.*/ - - node-v10-latest: - requires: - - analysis - filters: - tags: - only: /.*/ - - node-v12-latest: - requires: - - analysis - filters: - tags: - only: /.*/ - - node-v14-latest: - requires: - - analysis - filters: - tags: - only: /.*/ diff --git a/.github/workflows/node-windows.yml b/.github/workflows/node-windows.yml deleted file mode 100644 index 786a4b3f323..00000000000 --- a/.github/workflows/node-windows.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Node - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: windows-2019 - - strategy: - matrix: - node: [ '14', '12', '10' ] - - name: ${{ matrix.node }} (Windows) - steps: - - name: Configure git line-breaks - run: git config --global core.autocrlf false - - name: Checkout Commit - uses: actions/checkout@v1 - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - name: Install dependencies - run: npm ci --ignore-scripts - - name: Run tests - run: npm test - env: - CI: true diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml deleted file mode 100644 index 3356fef8d49..00000000000 --- a/.github/workflows/pr-comment.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: PR Comment - -on: - pull_request_target: - -jobs: - comment: - runs-on: ubuntu-latest - steps: - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: 'Thank you for your contribution!' - - name: Create comment - if: steps.fc.outputs.comment-id == '' - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - ### Thank you for your contribution! ❤️ - - You can try out this pull request locally by installing Rollup via - - ```bash - npm install ${{ github.event.pull_request.head.repo.full_name }}#${{ github.event.pull_request.head.ref }} - ``` - - Once a build has completed, you can load it into the REPL by inserting the CircleCI build number of the **ci/circleci: node-v12-latest** build into the link below (unfortunately, we cannot auto-update this comment for PRs from forks at this time): - ``` - https://rollupjs.org/repl/?circleci= - ``` - diff --git a/.github/workflows/repl-artefacts.yml b/.github/workflows/repl-artefacts.yml new file mode 100644 index 00000000000..bb301df1418 --- /dev/null +++ b/.github/workflows/repl-artefacts.yml @@ -0,0 +1,66 @@ +name: Upload REPL artefacts + +on: + pull_request_target: + +jobs: + upload: + runs-on: ubuntu-latest + name: Upload + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 14 + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Build artefacts + run: npm run build:cjs && npm run build:bootstrap + - name: Upload "${{ github.event.pull_request.number }}/rollup.browser.js" to bucket + uses: zdurham/s3-upload-github-action@master + with: + args: --cache-control max-age=300,public + env: + FILE: dist/rollup.browser.js + AWS_REGION: ${{ secrets.AWS_REGION }} + S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + S3_KEY: ${{ github.event.pull_request.number }}/rollup.browser.js + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Upload "${{ github.event.pull_request.number }}/rollup.browser.js.map" to bucket + uses: zdurham/s3-upload-github-action@master + with: + args: --cache-control max-age=300,public + env: + FILE: dist/rollup.browser.js.map + AWS_REGION: ${{ secrets.AWS_REGION }} + S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + S3_KEY: ${{ github.event.pull_request.number }}/rollup.browser.js.map + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: 'Thank you for your contribution!' + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + edit-mode: replace + body: | + ### Thank you for your contribution! ❤️ + + You can try out this pull request locally by installing Rollup via + + ```bash + npm install ${{ github.event.pull_request.head.repo.full_name }}#${{ github.event.pull_request.head.ref }} + ``` + + or load it into the REPL: + https://rollupjs.org/repl/?pr=${{ github.event.pull_request.number }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000000..5207d68510e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,93 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + +jobs: + linux14: + runs-on: ubuntu-latest + name: Node 14 + Coverage (Linux) + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Run tests with coverage + run: npm run ci:coverage + env: + CI: true + + linux12: + runs-on: ubuntu-latest + name: Node 12 + Extra Tests (Linux) + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '12' + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Lint + run: npm run ci:lint + - name: Vulnerabilities + run: npm run security + - name: Run all tests + run: npm run ci:test + env: + CI: true + + linux10: + runs-on: ubuntu-latest + name: Node 10 (Linux) + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '10' + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Run tests + run: npm run ci:test:only + env: + CI: true + + windows: + runs-on: windows-2019 + strategy: + matrix: + node: ['14', '12', '10'] + name: Node ${{ matrix.node }} (Windows) + steps: + - name: Configure git line-breaks + run: git config --global core.autocrlf false + - name: Checkout Commit + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Run tests + run: npm test + env: + CI: true diff --git a/scripts/post-comment.js b/scripts/post-comment.js deleted file mode 100755 index 2e29de90ae0..00000000000 --- a/scripts/post-comment.js +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env node - -const path = require('path'); -const fetch = require('node-fetch'); - -const authToken = process.env.GH_AUTH_TOKEN; -if (!authToken) { - console.log('Could not find auth token.'); - process.exit(0); -} - -const prNumber = path.basename( - process.env.CIRCLE_PULL_REQUEST || process.env.CI_PULL_REQUEST || '' -); -if (!prNumber) { - console.log('No pull request number found'); - process.exit(0); -} - -const headline = '### Thank you for your contribution! ❤️'; - -postComment(); - -async function postComment() { - const existingId = await findExistingComment(); - console.log(existingId ? `Update comment ${existingId}` : 'Create new comment.'); - const installPath = await getInstallPath(); - const path = existingId ? `issues/comments/${existingId}` : `issues/${prNumber}/comments`; - const method = existingId ? 'PATCH' : 'POST'; - await fetch(getApiUrl(path), { - method, - body: JSON.stringify({ - body: `${headline} - -You can try out this pull request locally by installing Rollup via - -\`\`\` -npm install ${installPath} -\`\`\` - -or load it into the REPL: -https://rollupjs.org/repl/?circleci=${process.env.CIRCLE_BUILD_NUM} -` - }) - }); -} - -async function findExistingComment() { - const comments = await (await fetch(getApiUrl(`issues/${prNumber}/comments`), {})).json(); - const existingComment = comments.find(comment => comment.body.startsWith(headline)); - return existingComment && existingComment.id; -} - -async function getInstallPath() { - const prInfo = await (await fetch(getApiUrl(`pulls/${prNumber}`), {})).json(); - return `${prInfo.head.repo.full_name}#${prInfo.head.ref}`; -} - -function getApiUrl(path) { - return `https://${authToken}:x-oauth-basic@api.github.com/repos/rollup/rollup/${path}`; -}