renovate/.github/workflows/build.yml

192 lines
5.4 KiB
YAML
Raw Normal View History

2020-03-26 05:59:57 +00:00
name: build
on:
push:
branches:
- main
- v24
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
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:
runs-on: ${{ matrix.os }}
# tests shouldn't need more time
timeout-minutes: 30
strategy:
matrix:
2021-01-10 19:56:43 +00:00
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [14]
2021-06-01 15:19:55 +00:00
python-version: [3.9]
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 }}
PYTHON_VERSION: ${{ matrix.python-version }}
JAVA_VERSION: ${{ matrix.java-version }}
2020-02-28 11:19:18 +00:00
steps:
2021-07-05 12:18:50 +00:00
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 2
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2.2.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 Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v2.2.2
with:
2020-03-26 07:48:38 +00:00
python-version: ${{ env.PYTHON_VERSION }}
2020-03-26 07:48:38 +00:00
- name: Set up Java ${{ env.JAVA_VERSION }}
if: env.NODE_VERSION == '14'
uses: actions/setup-java@v2.1.0
with:
2020-03-26 07:48:38 +00:00
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
java-package: jre
check-latest: false
- name: Skip Java tests
if: env.NODE_VERSION != '14'
2020-10-29 10:41:01 +00:00
run: echo "SKIP_JAVA_TESTS=true" >> $GITHUB_ENV
- 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
2020-03-11 07:52:41 +00:00
echo "Node $(node --version)"
python --version
2020-03-11 07:52:41 +00:00
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@v1.5.2
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:
2021-07-05 12:18:50 +00:00
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 2
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2.2.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
yarn eslint -f ./tmp/tools/eslint-gh-reporter.js
yarn prettier
2021-05-20 19:07:18 +00:00
yarn markdown-lint
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
release:
needs: [lint, test]
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@v2.3.4
with:
fetch-depth: 0
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2.2.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 }}