72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
name: GoLang Tests
|
|
run-name: ${{ gitea.actor }} is testing golang Code
|
|
on: [push]
|
|
|
|
jobs:
|
|
testing:
|
|
name: Run Go Tests
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: arbeitszeitmessung
|
|
env:
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: arbeitszeitmessung
|
|
POSTGRES_PORT: 5432
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: Backend/go.mod
|
|
check-latest: true
|
|
- 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: arbeitszeitmessung-${{ steps.hash-go.outputs.hash }}
|
|
restore-keys: |-
|
|
arbeitszeitmessung-${{ steps.hash-go.outputs.hash }}
|
|
- name: Run Go Tests
|
|
run: cd Backend && go test ./...
|
|
build:
|
|
needs: testing
|
|
name: Build Go Image and Upload
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.letsstein.de
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: git.letsstein.de/tom/arbeitszeitmessung:latest
|