diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1be9fde0e33..fb2e31ef8ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,24 +8,39 @@ on: branches: - '**' +env: + PRIMARY_NODE_VERSION: 12 + jobs: primary_code_validation_and_tests: name: Primary code validation and tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Use Node.js 12 + - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} uses: actions/setup-node@v1 with: - node-version: 12 + node-version: ${{ env.PRIMARY_NODE_VERSION }} + + - 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- # This also runs a build as part of the postinstall bootstrap - - name: install and build + - name: Install dependencies and build run: | yarn --ignore-engines --frozen-lockfile yarn check-clean-workspace-after-install - # Note that this command *also* typechecks tests/tools, + # Note that this command *also* type checks tests/tools, # whereas the build only checks src files - name: Typecheck all packages run: yarn typecheck @@ -44,11 +59,6 @@ jobs: env: CI: true - - name: Run integrations tests - run: yarn integration-tests - env: - CI: true - - name: Publish code coverage report uses: codecov/codecov-action@v1 with: @@ -57,6 +67,39 @@ jobs: flags: unittest name: codecov + integration_tests: + name: Run integration tests on primary Node.js version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + + - 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- + + # This also runs a build as part of the postinstall bootstrap + - name: Install dependencies and build + run: | + yarn --ignore-engines --frozen-lockfile + yarn check-clean-workspace-after-install + + - name: Run integrations tests + run: yarn integration-tests + env: + CI: true + unit_tests_on_other_node_versions: name: Run unit tests on other Node.js versions runs-on: ubuntu-latest @@ -70,8 +113,20 @@ jobs: with: node-version: ${{ matrix.node-version }} + - 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- + # This also runs a build as part of the postinstall bootstrap - - name: install and build + - name: Install dependencies and build run: | yarn --ignore-engines --frozen-lockfile yarn check-clean-workspace-after-install @@ -88,19 +143,31 @@ jobs: if: github.event_name == 'push' && github.ref == 'refs/head/master' steps: - uses: actions/checkout@v1 - - name: Use Node.js 12 + - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} uses: actions/setup-node@v1 with: - node-version: 12 + 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- + # This also runs a build as part of the postinstall bootstrap - - name: install and build + - name: Install dependencies and build run: | yarn --ignore-engines --frozen-lockfile yarn check-clean-workspace-after-install -# - name: Publish all packages to npm -# run: npx lerna publish --canary --exact --force-publish --yes -# env: -# NODE_AUTH_TOKEN: ${{ secrets.npm_token }} + - name: Publish all packages to npm + run: npx lerna publish --canary --exact --force-publish --yes + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 172a64beab7..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,104 +0,0 @@ -trigger: - - master - -jobs: - - job: primary_code_validation_and_tests - displayName: Primary code validation and tests - pool: - vmImage: 'Ubuntu-18.04' - steps: - - task: NodeTool@0 - inputs: - versionSpec: 12 - displayName: 'Install Node.js 12' - - - script: | - # This also runs a build as part of the postinstall - # bootstrap - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install - - - script: | - # Note that this command *also* typechecks tests/tools, - # whereas the build only checks src files - yarn typecheck - displayName: 'Typecheck all packages' - - - script: | - yarn format-check - displayName: 'Check code formatting' - - - script: | - yarn lint - displayName: 'Run linting' - - - script: | - yarn check:spelling - displayName: 'Validate documentation spelling' - - - script: | - yarn test - displayName: 'Run unit tests' - - - script: | - yarn integration-tests - displayName: 'Run integrations tests' - - - bash: bash <(curl -s https://codecov.io/bash) -P "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - displayName: 'Publish code coverage report' - - - job: unit_tests_on_other_node_versions - displayName: Run unit tests on other Node.js versions - pool: - vmImage: 'Ubuntu-18.04' - strategy: - maxParallel: 3 - matrix: - node_10_x: - node_version: 10.x - node_8_x: - node_version: 8.x - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version) - displayName: 'Install Node.js $(node_version)' - - - script: | - # This also runs a build as part of the postinstall - # bootstrap - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install - - - script: | - yarn test - displayName: 'Run unit tests' - - - job: publish_canary_version - displayName: Publish the latest code as a canary version - dependsOn: - - primary_code_validation_and_tests - - unit_tests_on_other_node_versions - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest')) - pool: - vmImage: 'Ubuntu-18.04' - steps: - - task: NodeTool@0 - inputs: - versionSpec: 12 - displayName: 'Install Node.js 12' - - - script: | - # This also runs a build as part of the postinstall - # bootstrap - yarn --ignore-engines --frozen-lockfile - yarn check-clean-workspace-after-install - - - script: | - npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) - - - script: | - npx lerna publish --canary --exact --force-publish --yes - displayName: 'Publish all packages to npm'