refactor: CI/CD pipelines (#5)
Some checks failed
CD / test (push) Successful in 43s
CD / Build and push (push) Failing after 26s

Reviewed-on: #5
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #5.
This commit is contained in:
2024-04-01 21:47:18 +02:00
committed by t.behrendt
parent 74c38313a2
commit 380d7eaa4e
2 changed files with 43 additions and 13 deletions

View File

@@ -1,19 +1,52 @@
name: CD
on:
workflow_run:
workflows:
- CI
push:
branches:
- main
types:
- completed
env:
DOCKER_REGISTRY: gitea.t000-n.de
jobs:
build:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Create cache key
uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: actions/cache@v4
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
restore-keys: |-
go_cache-${{ steps.hash-go.outputs.hash }}
- name: build
run: make build
- name: test
run: make test
build_and_push:
name: Build and push
requires:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -28,7 +61,7 @@ jobs:
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
registry: ${{ input.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
@@ -48,5 +81,5 @@ jobs:
linux/arm64
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest
${{ input.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ input.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest

View File

@@ -1,9 +1,6 @@
name: CI
on:
pull_request:
push:
branches:
- main
env:
GOPATH: /go_path
@@ -11,7 +8,7 @@ env:
RUNNER_TOOL_CACHE: /toolcache
jobs:
testing:
test:
name: test
runs-on: ubuntu-latest
steps: