This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
Change server,cli make targets to build for running platform #212
Workflow file for this run
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: For each commit and PR | |
on: | |
push: | |
pull_request: | |
jobs: | |
validation: | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: goimports | |
run: go get golang.org/x/tools/cmd/goimports && goimports -d . | (! grep .) | |
# Workaround for missing checksums caused by https://github.com/golang/go/issues/44129 | |
- name: gomod fix | |
run: go env -w GOFLAGS=-mod=mod | |
- name: lint | |
run: make lint | |
- name: tests | |
run: make test-only | |
- name: go test coverage | |
run: go test -coverprofile=coverage.txt ./... | |
- name: upload codecov | |
run: bash <(curl -s https://codecov.io/bash) | |
docker-images: | |
name: build image and possibly push image to quay.io | |
runs-on: ubuntu-latest | |
needs: [validation] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: quay.io/packet/cacher | |
tags: | | |
type=sha | |
type=ref,event=branch | |
- name: Login to Quay | |
uses: docker/login-action@v1 | |
if: ${{ startsWith(github.ref, 'refs/heads/master') }} | |
with: | |
registry: quay.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-cache | |
restore-keys: | | |
${{ runner.os }}-cache | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2 | |
with: | |
platforms: linux/amd64 | |
push: ${{ startsWith(github.ref, 'refs/heads/master') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
builder: ${{ steps.buildx.outputs.name }} |