From beb6e52f0fe2a38d93681292ac0f6711a1ea1752 Mon Sep 17 00:00:00 2001 From: ylemkimon Date: Mon, 11 Oct 2021 05:10:48 +0900 Subject: [PATCH] ci: run macOS, Windows, Java tests on `ci:fulltest` label (#12086) --- .github/workflows/build-pr.yml | 110 --------------------------------- .github/workflows/build.yml | 31 ++++++++-- 2 files changed, 25 insertions(+), 116 deletions(-) delete mode 100644 .github/workflows/build-pr.yml diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml deleted file mode 100644 index aeffcdfc95a59c..00000000000000 --- a/.github/workflows/build-pr.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: build-pr - -on: - pull_request: - -env: - NODE_VERSION: 14 - PYTHON_VERSION: 3.9 - SKIP_JAVA_TESTS: true - -concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - runs-on: ubuntu-latest - - # tests shouldn't need more time - timeout-minutes: 30 - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # renovate: tag=v2.3.4 - with: - fetch-depth: 2 - - - name: Set up Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@270253e841af726300e85d718a5f606959b2903c # renovate: tag=v2.4.1 - with: - node-version: ${{ env.NODE_VERSION }} - cache: yarn - - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@dc73133d4da04e56a135ae2246682783cc7c7cb6 # renovate: tag=v2.2.2 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Init platform - shell: bash - run: | - git config --global core.autocrlf false - git config --global core.symlinks true - git config --global user.email 'renovate@whitesourcesoftware.com' - git config --global user.name 'Renovate Bot' - npm config set scripts-prepend-node-path true - git --version - echo "Node $(node --version)" - python --version - echo "Yarn $(yarn --version)" - - - name: Installing dependencies - run: yarn install --frozen-lockfile - - - name: Unit tests - run: yarn jest --maxWorkers=2 --ci - - - name: Codecov - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # renovate: tag=v2.1.0 - if: always() - - # build after tests to exclude files - - name: Build - run: yarn build - - - name: E2E Test - run: yarn test-e2e - - lint: - runs-on: ubuntu-latest - - # lint shouldn't need more than 10 min - timeout-minutes: 15 - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # renovate: tag=v2.3.4 - with: - fetch-depth: 2 - - - name: Set up Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@270253e841af726300e85d718a5f606959b2903c # renovate: tag=v2.4.1 - with: - node-version: ${{ env.NODE_VERSION }} - cache: yarn - - - name: Init platform - run: | - git config --global core.autocrlf false - git config --global core.symlinks true - git config --global user.email 'renovate@whitesourcesoftware.com' - git config --global user.name 'Renovate Bot' - npm config set scripts-prepend-node-path true - echo "Node $(node --version)" - echo "Yarn $(yarn --version)" - - - name: Installing dependencies - run: yarn install --frozen-lockfile - - - name: Lint - run: | - yarn ls-lint - yarn eslint -f gha - yarn prettier - yarn markdown-lint - yarn git-check - - - name: Test schema - run: yarn test-schema - - - name: Type check - run: yarn type-check diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79aaabf787be1c..a5ea6700a1c9f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,8 @@ on: - main - v25 + pull_request: + workflow_dispatch: inputs: dryRun: @@ -13,6 +15,10 @@ on: default: 'true' required: false +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + env: # Currently no way to detect automatically (#8153) DEFAULT_BRANCH: main @@ -21,6 +27,7 @@ env: jobs: test: + name: ${{ format('test ({0})', matrix.os) }} runs-on: ${{ matrix.os }} # tests shouldn't need more time @@ -28,16 +35,31 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-11, windows-latest] + os: [ubuntu-latest] node-version: [14] python-version: [3.9] java-version: [11] + # skip macOS and Windows test on pull requests without 'ci:fulltest' label + include: >- + ${{ fromJSON((github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:fulltest')) && '[{ + "os": "macos-latest", + "node-version": 14, + "python-version": 3.9, + "java-version": 11 + }, { + "os": "windows-latest", + "node-version": 14, + "python-version": 3.9, + "java-version": 11 + }]' || '[]') }} env: coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 14 }} NODE_VERSION: ${{ matrix.node-version }} PYTHON_VERSION: ${{ matrix.python-version }} JAVA_VERSION: ${{ matrix.java-version }} + # skip Java tests on pull requests without 'ci:fulltest' label + SKIP_JAVA_TESTS: ${{ matrix.node-version != 14 || (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:fulltest')) }} steps: - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # renovate: tag=v2.3.4 @@ -56,7 +78,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} - name: Set up Java ${{ env.JAVA_VERSION }} - if: env.NODE_VERSION == '14' + if: env.SKIP_JAVA_TESTS == 'false' uses: actions/setup-java@8db439b6b47e5e12312bf036760bbaa6893481ac # renovate: tag=v2.3.1 with: java-version: ${{ env.JAVA_VERSION }} @@ -64,10 +86,6 @@ jobs: java-package: jre check-latest: false - - name: Skip Java tests - if: env.NODE_VERSION != '14' - run: echo "SKIP_JAVA_TESTS=true" >> $GITHUB_ENV - - name: Init platform shell: bash run: | @@ -145,6 +163,7 @@ jobs: release: needs: [lint, test] + if: github.event_name != 'pull_request' runs-on: ubuntu-latest # release shouldn't need more than 5 min timeout-minutes: 15