mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
206 lines
6.2 KiB
YAML
206 lines
6.2 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
dryRun:
|
|
description: 'Dry-Run'
|
|
default: 'true'
|
|
required: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# Currently no way to detect automatically (#8153)
|
|
DEFAULT_BRANCH: main
|
|
NODE_VERSION: 16
|
|
DRY_RUN: true
|
|
|
|
jobs:
|
|
test:
|
|
name: ${{ matrix.node-version == 16 && format('test ({0})', matrix.os) || format('test ({0}, node-{1})', matrix.os, matrix.node-version) }}
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
# tests shouldn't need more time
|
|
timeout-minutes: 45
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
node-version: [14, 16, 18]
|
|
# 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": 16
|
|
}, {
|
|
"os": "windows-latest",
|
|
"node-version": 16
|
|
}]' || '[]') }}
|
|
|
|
env:
|
|
coverage: ${{ matrix.os == 'ubuntu-latest' && (matrix.node-version == 16 || matrix.node-version == 18) }}
|
|
NODE_VERSION: ${{ matrix.node-version }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3.5.1
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: yarn
|
|
|
|
- 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)"
|
|
echo "Yarn $(yarn --version)"
|
|
|
|
- name: Installing dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
# build before tests to for static file check
|
|
- name: Build
|
|
run: yarn build
|
|
|
|
- name: Cache jest cache
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # tag=v3.0.11
|
|
with:
|
|
path: .cache/jest
|
|
key: ${{ runner.os }}-${{ matrix.node-version }}-jest-${{ hashFiles('yarn.lock') }}
|
|
|
|
- name: Unit tests
|
|
run: yarn jest --ci --coverage ${{ env.coverage }}
|
|
|
|
- name: Codecov
|
|
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # tag=v3.1.1
|
|
if: always() && env.coverage == 'true'
|
|
|
|
- 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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3.5.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
|
|
yarn doc-fence-check
|
|
|
|
- name: Test schema
|
|
run: yarn test-schema
|
|
|
|
- name: Type check
|
|
run: yarn type-check
|
|
|
|
- name: Strict check
|
|
run: yarn strict-check
|
|
|
|
release:
|
|
needs: [lint, test]
|
|
if: github.repository == 'renovatebot/renovate' && github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
# release shouldn't need more than 5 min
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
# full checkout for semantic-release
|
|
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3.5.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'
|
|
|
|
- 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
|
|
|
|
- name: Installing dependencies
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: semantic-release
|
|
run: |
|
|
echo '//registry.yarnpkg.com/:_authToken=${NPM_TOKEN}' >> ./.npmrc
|
|
yarn semantic-release --dry-run ${{env.DRY_RUN}}
|
|
git checkout -- .npmrc
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Upload docs
|
|
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3.1.1
|
|
with:
|
|
name: docs
|
|
path: tmp/docs/
|