Merge pull request #102 from scribd/maksimt/SERF-3223/kafka-client #509
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: push | |
env: | |
DOCKER_CACHE_PATH: ${{ github.workspace }}/tmp/docker-cache | |
DOCKER_BUILDKIT: 1 | |
BUILDX_CACHE_PATH: /tmp/.buildx-cache | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Inject slug/short variables | |
# A GitHub Action to expose the slug values of some GitHub ENV variables | |
# https://github.com/rlespinasse/github-slug-action | |
uses: rlespinasse/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.BUILDX_CACHE_PATH }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: docker/build-push-action@v3 | |
# GitHub Action to build and push Docker images with Buildx | |
# https://github.com/docker/build-push-action | |
name: Build image | |
with: | |
push: false | |
target: builder | |
tags: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
cache-from: type=local,src=${{ env.BUILDX_CACHE_PATH }} | |
cache-to: type=local,dest=${{ env.BUILDX_CACHE_PATH }} | |
check: | |
name: check | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Inject slug/short variables | |
# A GitHub Action to expose the slug values of some GitHub ENV variables | |
# https://github.com/rlespinasse/github-slug-action | |
uses: rlespinasse/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Get cached Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.BUILDX_CACHE_PATH }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: docker/build-push-action@v3 | |
# GitHub Action to build and push Docker images with Buildx | |
# https://github.com/docker/build-push-action | |
name: Build image | |
with: | |
push: false | |
target: linter | |
tags: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
cache-from: type=local,src=${{ env.BUILDX_CACHE_PATH }} | |
load: true | |
- uses: addnab/docker-run-action@v2 | |
# Run an image built by a previous step. | |
# https://github.com/addnab/docker-run-action | |
# https://github.com/marketplace/actions/docker-run-action | |
name: Check format | |
with: | |
image: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
run: mage fmt:check | |
- uses: addnab/docker-run-action@v2 | |
# Run an image built by a previous step. | |
# https://github.com/addnab/docker-run-action | |
# https://github.com/marketplace/actions/docker-run-action | |
name: Run linter | |
with: | |
image: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
run: mage fmt:lint | |
test: | |
name: test | |
needs: [build, check] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Inject slug/short variables | |
# A GitHub Action to expose the slug values of some GitHub ENV variables | |
# https://github.com/rlespinasse/github-slug-action | |
uses: rlespinasse/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Get cached Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.BUILDX_CACHE_PATH }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: docker/build-push-action@v3 | |
# GitHub Action to build and push Docker images with Buildx | |
# https://github.com/docker/build-push-action | |
name: Build image | |
with: | |
push: false | |
target: builder | |
load: true | |
tags: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
cache-from: type=local,src=${{ env.BUILDX_CACHE_PATH }} | |
- uses: addnab/docker-run-action@v2 | |
# Run an image built by a previous step. | |
# https://github.com/addnab/docker-run-action | |
# https://github.com/marketplace/actions/docker-run-action | |
name: Run tests | |
with: | |
image: ${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }} | |
run: mage test:run |