use separate test and release actions
Some checks failed
Go / checks (push) Has been cancelled

This commit is contained in:
Gustavo Maronato 2023-09-21 16:20:59 -03:00
parent 8ac3eef33a
commit 67f07b7601
Signed by: maronato
SSH Key Fingerprint: SHA256:2Gw7kwMz/As+2UkR1qQ/qYYhn+WNh3FGv6ozhoRrLcs
2 changed files with 47 additions and 19 deletions

32
.github/workflows/go.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Go
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
- name: build
run: make build
- name: test
run: make test

View File

@ -1,19 +1,16 @@
name: Build
name: Release
# Controls when the workflow will run
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"
release:
types:
- published
jobs:
build:
buildpush:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- # Get the repository's code
name: Checkout
@ -55,7 +52,7 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- # httos://github.com/actions/cache
name: Configure cache
name: Cache Docker layers
uses: actions/cache@v3
with:
path: |
@ -63,9 +60,9 @@ jobs:
/tmp/.npm-cache
/tmp/.go-build-cache
/tmp/.buildx-cache
key: ${{ runner.os }}-build-
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-buildx-
- # https://github.com/docker/build-push-action
name: Build and push
uses: docker/build-push-action@v2
@ -78,12 +75,11 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
cache-to: type=local,dest=/tmp/.build-cache/buildx-new,mode=max
- # "Temp" fix
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.build-cache/buildx
mv /tmp/.build-cache/buildx-new /tmp/.build-cache/buildx
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache