Skip to content

Commit

Permalink
chore(ci): simplify workflows (#5782)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Mar 26, 2020
1 parent 50b18aa commit 7dd49f9
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 131 deletions.
112 changes: 87 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
DOCKER_REPO: renovate/renovate
YARN_CACHE_KEY: v1
BUILDX_VERSION: v0.3.1
NODE_VERSION: 12
# https://github.com/chalk/supports-color/issues/106
FORCE_COLOR: true

Expand Down Expand Up @@ -40,7 +41,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [10, 12]
node-version: [12, 10]
python-version: [3.8]
java-version: [11]
exclude:
Expand All @@ -49,26 +50,29 @@ jobs:

env:
coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 12 }}
NODE_VERSION: ${{ matrix.node-version }}
PYTHON_VERSION: ${{ matrix.python-version }}
JAVA_VERSION: ${{ matrix.java-version }}

steps:
- name: Set up Node.js ${{ matrix.node-version }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Set up Java ${{ matrix.java-version }}
if: matrix.node-version == 12 && github.ref != 'refs/heads/master'
- name: Set up Java ${{ env.JAVA_VERSION }}
if: env.NODE_VERSION == '12'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
java-version: ${{ env.JAVA_VERSION }}

- name: Skip Java tests
if: matrix.node-version != 12 || github.ref == 'refs/heads/master'
if: env.NODE_VERSION != '12'
run: echo "::set-env name=SKIP_JAVA_TESTS::true"

- name: Init platform
Expand Down Expand Up @@ -101,18 +105,18 @@ jobs:
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-yarn-
${{ runner.os }}-${{ env.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') }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-
# Clear caches on cache miss, otherwise they will grow indefinitely
- name: Clear yarn cache
Expand Down Expand Up @@ -154,21 +158,17 @@ jobs:
run: yarn test-e2e

lint:
runs-on: ${{ matrix.os }}
needs: [cleanup]
runs-on: ubuntu-latest

# 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 }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ env.NODE_VERSION }}

- name: Init platform
id: init
Expand Down Expand Up @@ -198,9 +198,9 @@ jobs:
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-yarn-
${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-
# Clear caches on cache miss, otherwise they will grow indefinitely
- name: Clear yarn cache
Expand Down Expand Up @@ -256,6 +256,68 @@ jobs:
release:
needs: [lint, test, test-docker]
runs-on: ubuntu-latest
timeout-minutes: 5
# release shouldn't need more than 30 min
timeout-minutes: 30

steps:
- run: echo "Release"
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}

- name: Init platform
id: init
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'
yarn config set version-git-tag false
- uses: actions/checkout@v2

- name: Cache Yarn packages
id: yarn_cache_packages
uses: actions/cache@v1
with:
path: ${{ steps.init.outputs.yarn_cache }}
key: ${{ env.YARN_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }}

- name: Cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Installing dependencies
run: yarn install --frozen-lockfile --link-duplicates

- name: Build
run: yarn build

- name: Set up Docker Buildx ${{ env.BUILDX_VERSION }}
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: ${{ env.BUILDX_VERSION }}

- name: Docker registry login
run: echo "${{ secrets.DOCKER_RENOVATERELEASE_TOKEN }}" | docker login -u renovaterelease --password-stdin

- name: Update Docker images cache
continue-on-error: true
if: ${{github.ref == 'refs/heads/master'}}
run: |
docker buildx bake \
--file docker/bake.hcl \
--set latest.cache-to=type=registry,ref=renovate/docker-build-cache:renovate-latest,mode=max \
--set slim.cache-to=type=registry,ref=renovate/docker-build-cache:renovate-slim,mode=max \
default
- name: semantic-release
run: |
echo '//registry.yarnpkg.com/:_authToken=${NPM_TOKEN}' > ~/.npmrc
yarn semantic-release --dry-run ${{github.ref != 'refs/heads/master'}}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
106 changes: 0 additions & 106 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 7dd49f9

Please sign in to comment.