From a7c93bedc007027a9e9645e4c2d85fc519935049 Mon Sep 17 00:00:00 2001 From: V Date: Sat, 16 May 2026 21:01:27 +0100 Subject: [PATCH] Testing actions --- .gitea/workflows/ci.yml | 34 ++++++++++++++++++++++ .gitea/workflows/publish.yml | 56 ++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..226b667 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches-ignore: + - main + +jobs: + lint-test: + name: Lint and test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Check formatting + run: | + files="$(gofmt -l .)" + if [ -n "$files" ]; then + echo "The following files need gofmt:" + echo "$files" + exit 1 + fi + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./... diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..09edcd7 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,56 @@ +name: Publish + +on: + push: + branches: + - main + +jobs: + build-push: + name: Test, build, and push image + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Check formatting + run: | + files="$(gofmt -l .)" + if [ -n "$files" ]; then + echo "The following files need gofmt:" + echo "$files" + exit 1 + fi + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./... + + - name: Read version + run: | + version="$(tr -d '[:space:]' < VERSION)" + if [ -z "$version" ]; then + echo "VERSION file is empty" + exit 1 + fi + echo "VERSION=$version" >> "$GITHUB_ENV" + echo "IMAGE=k3crpi.jumpingcrab.com/sabisan:$version" >> "$GITHUB_ENV" + + - name: Log in to registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login k3crpi.jumpingcrab.com \ + --username "${{ secrets.REGISTRY_USERNAME }}" \ + --password-stdin + + - name: Build image + run: docker build --pull --tag "$IMAGE" . + + - name: Push image + run: docker push "$IMAGE"