From 8a4a396ec55bf3a1d4d949e3c0b44ab93746a0ec Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 10 May 2020 10:29:29 -0700 Subject: [PATCH] chore: setup automatic RC releases for v3 branch (#2000) --- .github/workflows/ci.yml | 109 +++++++++++++++++++++++++++++++-------- package.json | 27 +++++----- 2 files changed, 101 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fcbc40561c..60e6627de93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,11 +38,15 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - # This also runs a build as part of the postinstall bootstrap - - name: Install dependencies and build + - name: Install dependencies run: | - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build + run: | + yarn build # Note that this command *also* type checks tests/tools, # whereas the build only checks src files @@ -84,14 +88,18 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - # This also runs a build as part of the postinstall bootstrap - - name: Install dependencies and build + - name: Install dependencies + run: | + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build run: | - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install + yarn build - name: Check code formatting - run: yarn format-check + run: yarn check:format - name: Lint code run: yarn lint @@ -124,14 +132,18 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - # This also runs a build as part of the postinstall bootstrap - - name: Install dependencies and build + - name: Install dependencies + run: | + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build run: | - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install + yarn build - name: Run integrations tests - run: yarn integration-tests + run: yarn test:integration env: CI: true @@ -160,11 +172,15 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - # This also runs a build as part of the postinstall bootstrap - - name: Install dependencies and build + - name: Install dependencies run: | - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build + run: | + yarn build - name: Run unit tests # the internal plugin is only run locally, so it doesn't have to support older versions @@ -201,13 +217,62 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - # This also runs a build as part of the postinstall bootstrap - - name: Install dependencies and build + - name: Install dependencies run: | - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build + run: | + yarn build - name: Publish all packages to npm run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + # TODO - delete this before merging v3 into master + publish_v3_prerelease_version: + name: Publish the latest code as a v3 prerelease version + runs-on: ubuntu-latest + needs: [primary_code_validation_and_tests, unit_tests_on_other_node_versions, linting_and_style, integration_tests] + if: github.ref == 'refs/heads/v3' + steps: + - uses: actions/checkout@v2 + # Fetch all history for all tags and branches in this job because lerna needs it + - run: | + git fetch --prune --unshallow + + - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + registry-url: https://registry.npmjs.org/ + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: | + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn lerna:init + yarn check:clean-workspace-after-install + + - name: Build + run: | + yarn build + + - name: Publish all packages to npm + run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v3 + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 164fe95a34c..41ba3591658 100644 --- a/package.json +++ b/package.json @@ -18,25 +18,26 @@ }, "scripts": { "build": "lerna run build", - "clean": "lerna clean && lerna run clean", - "cz": "git-cz", - "check:docs": "lerna run check:docs", + "check:clean-workspace-after-install": "git diff --quiet --exit-code", "check:configs": "lerna run check:configs", + "check:docs": "lerna run check:docs", + "check:format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", "check:spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"", - "generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate", + "clean": "lerna clean && lerna run clean", + "cz": "git-cz", "format": "prettier --write \"./**/*.{ts,js,json,md}\"", - "format-check": "prettier --list-different \"./**/*.{ts,js,json,md}\"", - "integration-tests": "./tests/integration/run-all-tests.sh", - "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", - "lint": "eslint . --ext .js,.ts", - "lint-fix": "eslint . --ext .js,.ts --fix", - "lint:markdown": "markdownlint '**/*.md' --config=.markdownlint.json --ignore-path=.markdownlintignore", + "generate:contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate", + "lerna:init": "lerna bootstrap --ignore-scripts && lerna link --force-local", + "lint:fix": "eslint . --ext .js,.ts --fix", "lint:markdown:fix": "lint:markdown --fix", + "lint:markdown": "markdownlint '**/*.md' --config=.markdownlint.json --ignore-path=.markdownlintignore", + "lint": "eslint . --ext .js,.ts", + "postinstall": "yarn lerna-init && yarn build", "pre-commit": "yarn lint-staged", - "pre-push": "yarn format-check", - "postinstall": "lerna bootstrap -- --ignore-engines && yarn build && lerna link", - "check-clean-workspace-after-install": "git diff --quiet --exit-code", + "pre-push": "yarn check:format", "test": "lerna run test --concurrency 1", + "test:integration": "./tests/integration/run-all-tests.sh", + "test:kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", "typecheck": "lerna run typecheck" }, "config": {