From 09f4ca57559148882370f0d41215e7ab2fe9b647 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 11 Jun 2026 23:44:46 +0800 Subject: [PATCH] ci: add Gitea Actions CI pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror of .github/workflows/ci.yml adapted for Gitea Actions: - Replace golangci-lint-action with direct install script - Remove upload-artifact (not needed on Gitea) - Same 4-job structure: lint → test → build → docker --- .gitea/workflows/ci.yml | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..6aba3a1 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + branches: [master] + tags: ["v*"] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Check formatting + run: | + go install mvdan.cc/gofumpt@latest + output=$(gofumpt -l .) + if [ -n "$output" ]; then + echo "Files need formatting:" + echo "$output" + exit 1 + fi + + - name: Install golangci-lint + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.0 + + - name: Run lint + run: golangci-lint run ./... + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run unit tests + run: go test -race -count=1 ./internal/... + + build: + name: Build + needs: [lint, test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build + run: make build + + - name: Verify binary + run: ./bin/lolly --help + + docker: + name: Docker + needs: build + if: github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: docker build -t lolly:latest .