renovate/.github/workflows/build.yml

213 lines
6.3 KiB
YAML
Raw Normal View History

2020-03-26 05:59:57 +00:00
name: build
on:
push:
branches:
- master
- 'renovate/**'
pull_request:
env:
YARN_MODULES_CACHE_KEY: v1
YARN_PACKAGE_CACHE_KEY: v1
YARN_CACHE_FOLDER: .cache/yarn
2020-03-26 07:48:38 +00:00
NODE_VERSION: 12
2020-03-26 05:59:57 +00:00
# https://github.com/chalk/supports-color/issues/106
FORCE_COLOR: true
jobs:
test:
runs-on: ${{ matrix.os }}
# tests shouldn't need more time
timeout-minutes: 30
strategy:
matrix:
2020-09-09 08:32:02 +00:00
os: [ubuntu-latest, macos-latest, windows-latest]
2020-10-29 10:41:01 +00:00
node-version: [12, ^14.15.0]
python-version: [3.8]
java-version: [8]
2020-09-09 08:32:02 +00:00
exclude:
- os: windows-latest
node-version: 10
2020-02-28 09:51:08 +00:00
env:
coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 12 }}
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:
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
2020-10-16 06:09:52 +00:00
uses: actions/setup-node@v1.4.4
with:
2020-03-26 07:48:38 +00:00
node-version: ${{ env.NODE_VERSION }}
2020-03-26 07:48:38 +00:00
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v2.1.4
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 == '12'
2020-10-16 06:09:52 +00:00
uses: actions/setup-java@v1.4.3
with:
2020-03-26 07:48:38 +00:00
java-version: ${{ env.JAVA_VERSION }}
- name: Skip Java tests
2020-03-26 07:48:38 +00:00
if: env.NODE_VERSION != '12'
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)"
2020-10-16 06:09:52 +00:00
- uses: actions/checkout@v2.3.3
- name: Cache Yarn packages
id: yarn_cache_packages
2020-10-16 06:09:52 +00:00
uses: actions/cache@v2.1.2
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-
# Clear caches on cache miss, otherwise they will grow indefinitely
- name: Clear yarn cache
if: steps.yarn_cache_packages.outputs.cache-hit != 'true'
run: yarn cache clean
- name: Installing dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Unit tests
2020-02-28 09:51:08 +00:00
run: yarn jest --maxWorkers=2 --ci --coverage ${{ env.coverage }}
2020-02-28 08:25:14 +00:00
2020-02-28 11:19:18 +00:00
- name: Upload coverage
2020-10-16 06:09:52 +00:00
uses: actions/upload-artifact@v2.2.0
2020-02-28 09:51:08 +00:00
if: always() && env.coverage == 'true'
2020-02-28 11:19:18 +00:00
with:
name: coverage
path: coverage
2020-02-28 13:28:23 +00:00
- name: Codecov
shell: bash
if: always() && env.coverage == 'true'
continue-on-error: true
run: bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- 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:
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
2020-10-16 06:09:52 +00:00
uses: actions/setup-node@v1.4.4
2020-02-28 09:51:08 +00:00
with:
2020-03-26 07:48:38 +00:00
node-version: ${{ env.NODE_VERSION }}
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
2020-10-16 06:09:52 +00:00
- uses: actions/checkout@v2.3.3
2020-02-28 09:51:08 +00:00
- name: Cache Yarn packages
id: yarn_cache_packages
2020-10-16 06:09:52 +00:00
uses: actions/cache@v2.1.2
2020-02-28 09:51:08 +00:00
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
2020-02-28 09:51:08 +00:00
restore-keys: |
${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-
2020-02-28 09:51:08 +00:00
# Clear caches on cache miss, otherwise they will grow indefinitely
- name: Clear yarn cache
if: steps.yarn_cache_packages.outputs.cache-hit != 'true'
run: yarn cache clean
- name: Installing dependencies
run: yarn install --frozen-lockfile
2020-02-28 09:51:08 +00:00
- name: Lint
run: |
yarn eslint -f ./tmp/tools/eslint-gh-reporter.js
yarn prettier
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:
2020-03-26 07:48:38 +00:00
- name: Set up Node.js ${{ env.NODE_VERSION }}
2020-10-16 06:09:52 +00:00
uses: actions/setup-node@v1.4.4
2020-03-26 07:48:38 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
- 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
# full checkout for semantic-release
2020-10-16 06:09:52 +00:00
- uses: actions/checkout@v2.3.3
with:
fetch-depth: 0
2020-03-26 07:48:38 +00:00
- name: Cache Yarn packages
2020-10-16 06:09:52 +00:00
uses: actions/cache@v2.1.2
2020-03-26 07:48:38 +00:00
with:
path: ${{ env.YARN_CACHE_FOLDER }}
key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
2020-03-26 07:48:38 +00:00
- name: Installing dependencies
run: yarn install --frozen-lockfile
2020-03-26 07:48:38 +00:00
- name: semantic-release
if: github.ref == 'refs/heads/master'
2020-03-26 07:48:38 +00:00
run: |
2020-03-28 11:51:32 +00:00
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
npx semantic-release --dry-run ${{github.ref != 'refs/heads/master'}} --ci ${{github.ref == 'refs/heads/master'}}
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 }}