renovate/.github/workflows/build.yml

213 lines
6.6 KiB
YAML
Raw Normal View History

2020-03-26 05:59:57 +00:00
name: build
on:
push:
branches:
- main
- v25
pull_request:
2021-03-01 12:08:23 +00:00
workflow_dispatch:
2021-04-22 06:26:02 +00:00
inputs:
dryRun:
description: 'Dry-Run'
default: 'true'
2021-07-05 12:18:50 +00:00
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
env:
2021-04-22 06:26:02 +00:00
# Currently no way to detect automatically (#8153)
DEFAULT_BRANCH: main
NODE_VERSION: 14
2021-04-22 06:26:02 +00:00
DRY_RUN: true
jobs:
test:
name: ${{ format('test ({0})', matrix.os) }}
runs-on: ${{ matrix.os }}
# tests shouldn't need more time
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14]
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,
"java-version": 11
}, {
"os": "windows-latest",
"node-version": 14,
"java-version": 11
}]' || '[]') }}
2020-02-28 09:51:08 +00:00
env:
coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 14 }}
2020-03-26 07:48:38 +00:00
NODE_VERSION: ${{ matrix.node-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')) }}
2020-02-28 11:19:18 +00:00
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0
2021-07-05 12:18:50 +00:00
with:
fetch-depth: 2
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@04c56d2f954f1e4c69436aa54cfef261a018f458 # renovate: tag=v2.5.0
with:
2020-03-26 07:48:38 +00:00
node-version: ${{ env.NODE_VERSION }}
2021-07-05 12:18:50 +00:00
cache: yarn
2020-03-26 07:48:38 +00:00
- name: Set up Java ${{ env.JAVA_VERSION }}
if: env.SKIP_JAVA_TESTS == 'false'
uses: actions/setup-java@5f00602cd1b2819185d88dc7a1b1985f598c6705 # renovate: tag=v2.4.0
with:
2020-03-26 07:48:38 +00:00
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
java-package: jre
check-latest: false
- name: Init platform
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
2020-07-22 18:11:22 +00:00
git config --global user.email 'renovate@whitesourcesoftware.com'
git config --global user.name 'Renovate Bot'
2020-03-28 11:51:32 +00:00
npm config set scripts-prepend-node-path true
2021-09-15 15:58:09 +00:00
git --version
2020-03-11 07:52:41 +00:00
echo "Node $(node --version)"
echo "Yarn $(yarn --version)"
- name: Installing dependencies
2020-12-14 20:17:30 +00:00
run: yarn install --frozen-lockfile
- name: Unit tests
run: yarn jest --maxWorkers=2 --ci --coverage ${{ env.coverage }}
2020-02-28 13:28:23 +00:00
- name: Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # renovate: tag=v2.1.0
2020-02-28 13:28:23 +00:00
if: always() && env.coverage == 'true'
2021-03-01 12:08:23 +00:00
2021-04-22 06:26:02 +00:00
# build after tests to exclude build files from tests
# TODO: check if build before test speeds up tests
2021-03-01 12:08:23 +00:00
- name: Build
run: yarn build
2020-02-28 13:28:23 +00:00
- name: E2E Test
run: yarn test-e2e
2020-02-28 09:51:08 +00:00
lint:
2020-03-26 07:48:38 +00:00
runs-on: ubuntu-latest
2020-02-28 09:51:08 +00:00
2020-02-28 11:19:18 +00:00
# lint shouldn't need more than 10 min
timeout-minutes: 15
2020-02-28 09:51:08 +00:00
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0
2021-07-05 12:18:50 +00:00
with:
fetch-depth: 2
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@04c56d2f954f1e4c69436aa54cfef261a018f458 # renovate: tag=v2.5.0
2020-02-28 09:51:08 +00:00
with:
2020-03-26 07:48:38 +00:00
node-version: ${{ env.NODE_VERSION }}
2021-07-05 12:18:50 +00:00
cache: yarn
2020-02-28 09:51:08 +00:00
- name: Init platform
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
2020-07-22 18:11:22 +00:00
git config --global user.email 'renovate@whitesourcesoftware.com'
2020-02-28 09:51:08 +00:00
git config --global user.name 'Renovate Bot'
2020-03-28 11:51:32 +00:00
npm config set scripts-prepend-node-path true
2020-03-11 07:52:41 +00:00
echo "Node $(node --version)"
echo "Yarn $(yarn --version)"
2020-02-28 09:51:08 +00:00
- name: Installing dependencies
2020-12-14 20:17:30 +00:00
run: yarn install --frozen-lockfile
2020-02-28 09:51:08 +00:00
- name: Lint
run: |
yarn ls-lint
2021-08-27 13:58:50 +00:00
yarn eslint -f gha
yarn prettier
2021-05-20 19:07:18 +00:00
yarn markdown-lint
yarn git-check
yarn doc-fence-check
2020-02-28 09:51:08 +00:00
- name: Test schema
run: yarn test-schema
- name: Type check
run: yarn type-check
2020-03-26 05:59:57 +00:00
- name: Null check
run: yarn null-check
2020-03-26 05:59:57 +00:00
release:
needs: [lint, test]
if: github.event_name != 'pull_request'
2020-03-26 05:59:57 +00:00
runs-on: ubuntu-latest
2020-03-29 15:31:30 +00:00
# release shouldn't need more than 5 min
timeout-minutes: 15
2020-03-26 07:48:38 +00:00
2020-03-26 05:59:57 +00:00
steps:
2021-07-05 12:18:50 +00:00
# full checkout for semantic-release
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0
2021-07-05 12:18:50 +00:00
with:
fetch-depth: 0
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@04c56d2f954f1e4c69436aa54cfef261a018f458 # renovate: tag=v2.5.0
2020-03-26 07:48:38 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
2021-07-05 12:18:50 +00:00
cache: yarn
2020-03-26 07:48:38 +00:00
- name: Init platform
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
2020-07-22 18:11:22 +00:00
git config --global user.email 'renovate@whitesourcesoftware.com'
2020-03-26 07:48:38 +00:00
git config --global user.name 'Renovate Bot'
yarn config set version-git-tag false
2020-03-28 11:51:32 +00:00
npm config set scripts-prepend-node-path true
2020-03-26 07:48:38 +00:00
2021-04-22 06:26:02 +00:00
- name: Check dry run
run: |
if [[ "${{github.event_name}}" == "workflow_dispatch" && "${{ github.event.inputs.dryRun }}" != "true" ]]; then
echo "DRY_RUN=false" >> $GITHUB_ENV
elif [[ "${{github.ref}}" == "refs/heads/${{env.DEFAULT_BRANCH}}" ]]; then
echo "DRY_RUN=false" >> $GITHUB_ENV
elif [[ "${{github.ref}}" =~ ^refs/heads/v[0-9]+(\.[0-9]+)?$ ]]; then
echo "DRY_RUN=false" >> $GITHUB_ENV
fi
2020-03-26 07:48:38 +00:00
- name: Installing dependencies
2020-12-14 20:17:30 +00:00
run: yarn install --frozen-lockfile
2020-03-26 07:48:38 +00:00
- name: semantic-release
run: |
2021-07-05 15:33:42 +00:00
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ./.npmrc
2021-04-22 06:26:02 +00:00
npx semantic-release --dry-run ${{env.DRY_RUN}}
2021-07-05 16:55:09 +00:00
git checkout -- .npmrc
2020-03-26 07:48:38 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
2020-03-28 11:51:32 +00:00
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload docs
uses: actions/upload-artifact@da838ae9595ac94171fa2d4de5a2f117b3e7ac32 # renovate: tag=v2.3.0
with:
name: docs
2021-12-09 21:19:31 +00:00
path: tmp/docs/