Use a build-job matrix so components can be built in parallel

pull/239/head
HubbeKing 3 years ago committed by Mike Lang
parent 7312eda8c4
commit 4fe27d556a

@ -16,27 +16,41 @@ permissions:
contents: read contents: read
packages: write packages: write
# build components using a job matrix, so they can run in parallel
jobs: jobs:
build: build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env:
TAG: ${GITHUB_SHA::8}
strategy:
fail-fast: true # cancel all in-progress jobs if any matrix job fails
matrix:
component:
- downloader
- restreamer
- backfiller
- thrimshim
- cutter
- sheetsync
- nginx
- postgres
- segment_coverage
- playlist_manager
steps: steps:
# Checks out repository under $GITHUB_WORKSPACE, so we can access it - name: Check out repo
- uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Log into ghcr.io - name: Log into ghcr.io
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Run build script - name: Build ${{ matrix.component }}
run: | uses: docker/build-push-action@v2.7.0
# always push with:
export PUSH=true context: ./${{ matrix.component }}
# if this is a push to master and not a PR, also push latest - GITHUB_HEAD_REF is only set for PRs file: Dockerfile
if [ -z ${GITHUB_HEAD_REF+x} ] && [ "$GITHUB_REF" == "refs/heads/master" ]; then export PUSH=latest; fi tags: ghcr.io/ekimekim/wubloader-${{ matrix.component }}:$TAG,ghcr.io/ekimekim/wubloader-${{ matrix.component }}:latest
# build and push all components. try to pull and re-use layers from images for all parent commits. push: true
'CACHE_FROM=$(git rev-list HEAD -n1 --parents | cut -d" " -f 2-) ./build'

Loading…
Cancel
Save