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