mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
5311e4baf4
Otherwise we get missing base report on codecov
202 lines
6 KiB
YAML
202 lines
6 KiB
YAML
name: Test CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- 'renovate/**'
|
|
|
|
pull_request:
|
|
|
|
env:
|
|
CI: true
|
|
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
# tests shouldn't need more than 15 min
|
|
timeout-minutes: 15
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
node-version: [10, 12]
|
|
python-version: [3.8]
|
|
java-version: [11]
|
|
exclude:
|
|
- os: windows-latest
|
|
node-version: 10
|
|
|
|
env:
|
|
coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 12 }}
|
|
|
|
steps:
|
|
- name: Set up Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Set up Java ${{ matrix.java-version }}
|
|
if: matrix.node-version == 12 && github.ref != 'refs/heads/master'
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: ${{ matrix.java-version }}
|
|
|
|
- name: Skip Java tests
|
|
if: matrix.node-version != 12 || github.ref == 'refs/heads/master'
|
|
run: echo "::set-env name=SKIP_JAVA_TESTS::true"
|
|
|
|
- name: Init platform
|
|
id: init
|
|
shell: bash
|
|
run: |
|
|
echo "::set-output name=yarn_cache::$(yarn cache dir)"
|
|
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=pip_cache::' + USER_CACHE_DIR)"
|
|
git config --global core.autocrlf false
|
|
git config --global core.symlinks true
|
|
git config --global user.email 'bot@renovateapp.com'
|
|
git config --global user.name 'Renovate Bot'
|
|
echo "Node $(node --version)"
|
|
python --version
|
|
echo "Yarn $(yarn --version)"
|
|
pip --version
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache Yarn packages
|
|
id: yarn_cache_packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ steps.init.outputs.yarn_cache }}
|
|
key: v1-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
v1-${{ runner.os }}-yarn_cache-
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.node-version }}-yarn-
|
|
|
|
- name: Cache pip packages
|
|
id: pip_cache_packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ steps.init.outputs.pip_cache }}
|
|
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.python-version }}-pip-
|
|
|
|
# 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: Clear pip cache
|
|
if: steps.pip_cache_packages.outputs.cache-hit != 'true'
|
|
run: python -c "from pip._internal.locations import USER_CACHE_DIR; from shutil import rmtree; rmtree(USER_CACHE_DIR, ignore_errors=True)"
|
|
|
|
- name: Installing dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
yarn install --frozen-lockfile --link-duplicates
|
|
pip install --user -r requirements.txt
|
|
|
|
- name: Build
|
|
run: yarn build
|
|
|
|
- name: Unit tests
|
|
run: yarn jest --maxWorkers=2 --ci --coverage ${{ env.coverage }}
|
|
|
|
- name: Upload coverage
|
|
uses: actions/upload-artifact@v1
|
|
if: always() && env.coverage == 'true'
|
|
with:
|
|
name: coverage
|
|
path: coverage
|
|
|
|
- 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
|
|
|
|
lint:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
# lint shouldn't need more than 10 min
|
|
timeout-minutes: 10
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
node-version: [12]
|
|
|
|
steps:
|
|
- name: Set up Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Init platform
|
|
id: init
|
|
shell: bash
|
|
run: |
|
|
echo "::set-output name=yarn_cache::$(yarn cache dir)"
|
|
git config --global core.autocrlf false
|
|
git config --global core.symlinks true
|
|
git config --global user.email 'bot@renovateapp.com'
|
|
git config --global user.name 'Renovate Bot'
|
|
echo "Node $(node --version)"
|
|
python --version
|
|
echo "Yarn $(yarn --version)"
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache Yarn packages
|
|
id: yarn_cache_packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ steps.init.outputs.yarn_cache }}
|
|
key: v1-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
v1-${{ runner.os }}-yarn_cache-
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.node-version }}-yarn-
|
|
|
|
# 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 --link-duplicates
|
|
|
|
- name: Lint
|
|
run: yarn lint
|
|
|
|
- name: Test schema
|
|
run: yarn test-schema
|
|
|
|
- name: Type check
|
|
run: yarn type-check
|