Files
MrixsCraft-server/.gitea/workflows/ci.yml
Vladimir Zagainov 79ebed5b01
Some checks failed
CI / lint (push) Successful in 1m57s
CI / test (push) Successful in 1m17s
CI / build (push) Successful in 21s
CI / docker (push) Failing after 2m27s
fix: repair CI/CD pipeline for Gitea Actions
- Remove actions/upload-artifact@v4 (not supported on Gitea, GHESNotSupportedError)
- Add job permissions (packages: write, contents: read)
- Fix master branch condition (github.ref_name compatible with Gitea)
- Fix Docker login: use gitea.actor + GITHUB_TOKEN instead of reserved GITEA_ secrets
- Lowercase image tags per Docker spec (mrixs/mrixscraft-server)
- Sync docker-compose.yml image reference
2026-06-01 17:01:44 +03:00

129 lines
3.0 KiB
YAML

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["master"]
env:
GO_VERSION: "1.25"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-lint-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-lint-${{ runner.os }}-
- name: Download Go modules
run: go mod download
- name: go vet
run: go vet ./...
- name: gofmt check
run: |
fmt=$(gofmt -l .)
if [ -n "$fmt" ]; then
echo "Files needing formatting:"
echo "$fmt"
exit 1
fi
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-test-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-test-${{ runner.os }}-
- name: Download Go modules
run: go mod download
- name: Run tests
run: go test ./... -v -race -cover
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-build-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-build-${{ runner.os }}-
- name: Download Go modules
run: go mod download
- name: Build binary
run: go build -o mrixscraft-server ./cmd/server
docker:
runs-on: ubuntu-latest
needs: build
if: github.ref_name == 'master'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: gitea.mrixs.me
username: ${{ gitea.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
gitea.mrixs.me/mrixs/mrixscraft-server:latest
gitea.mrixs.me/mrixs/mrixscraft-server:${{ github.sha }}
cache-from: type=registry,ref=gitea.mrixs.me/mrixs/mrixscraft-server:buildcache
cache-to: type=registry,ref=gitea.mrixs.me/mrixs/mrixscraft-server:buildcache,mode=max