feat: bump deps #379
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: actions | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
working-directory: backend | |
args: --modules-download-mode=readonly | |
- name: Install dependencies | |
run: | | |
cd ${{ github.workspace }}/backend | |
go mod download | |
- name: Test | |
run: | | |
cd ${{ github.workspace }}/backend | |
go test -timeout=60s -race -covermode atomic -coverprofile=covprofile -coverpkg=./... ./tests | |
- name: Submit coverage | |
run: | | |
cd ${{ github.workspace }}/backend | |
go install github.com/mattn/goveralls@latest | |
$(go env GOPATH)/bin/goveralls -service=github -coverprofile=covprofile | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
needs: [lint] | |
strategy: | |
matrix: | |
arch: [amd64, arm64, armv7] | |
os: [linux] | |
include: | |
- { arch: amd64, goarch: amd64, goarm: "" } | |
- { arch: arm64, goarch: arm64, goarm: "" } | |
- { arch: armv7, goarch: arm, goarm: 7 } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set env variables | |
run: | | |
echo "REPOSITORY=ghcr.io/${REPOSITORY:-$GITHUB_REPOSITORY}-api" >> $GITHUB_ENV | |
echo "DOCKER_USER=${DOCKER_USER:-$GITHUB_ACTOR}" >> $GITHUB_ENV | |
env: | |
REPOSITORY: ${{ secrets.REPOSITORY }} | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
- name: Build image | |
run: docker build --build-arg VERSION=$GITHUB_REF:$GITHUB_SHA --build-arg GOARCH=${{ matrix.goarch }} --build-arg GOARM=${{ matrix.goarm }} -t $REPOSITORY:${{ matrix.arch }} -f Dockerfile.backend . | |
- name: Publish image | |
if: github.ref == 'refs/heads/master' | |
run: | | |
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u $DOCKER_USER --password-stdin | |
docker push $REPOSITORY:${{ matrix.arch }} | |
manifest: | |
runs-on: ubuntu-latest | |
needs: [lint, build] | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set env variables | |
run: | | |
echo "REPOSITORY=ghcr.io/${REPOSITORY:-$GITHUB_REPOSITORY}-api" >> $GITHUB_ENV | |
echo "DOCKER_USER=${DOCKER_USER:-$GITHUB_ACTOR}" >> $GITHUB_ENV | |
env: | |
REPOSITORY: ${{ secrets.REPOSITORY }} | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
- name: Publish manifest | |
run: | | |
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u $DOCKER_USER --password-stdin | |
docker manifest create $REPOSITORY:latest $REPOSITORY:amd64 $REPOSITORY:arm64 $REPOSITORY:armv7 | |
docker manifest annotate $REPOSITORY $REPOSITORY:amd64 --arch "amd64" --os "linux" --variant "" | |
docker manifest annotate $REPOSITORY $REPOSITORY:arm64 --arch "arm64" --os "linux" --variant "" | |
docker manifest annotate $REPOSITORY $REPOSITORY:armv7 --arch "arm" --os "linux" --variant "7" | |
docker manifest push $REPOSITORY |