CI: Gitea Actions workflow (test+build+package), Makefile, config.yaml.example, .gitignore
This commit is contained in:
79
.gitea/workflows/ci.yaml
Normal file
79
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,79 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.gitea/**'
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
check-latest: true
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./... -v -count=1 -timeout 120s 2>&1
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
build:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
check-latest: true
|
||||
|
||||
- name: Build binary
|
||||
run: go build -ldflags="-s -w" -o ratatoskr ./cmd/ratatoskr/
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ratatoskr
|
||||
path: ratatoskr
|
||||
|
||||
package:
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ratatoskr
|
||||
|
||||
- name: Upload to Gitea Packages (generic)
|
||||
run: |
|
||||
VERSION="commit-$(echo '${{ gitea.sha }}' | cut -c1-7)"
|
||||
curl -sS -X PUT \
|
||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"http://gitea.hal9000.home/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/linux-amd64/ratatoskr" \
|
||||
--data-binary @ratatoskr
|
||||
echo "Uploaded ratatoskr version ${VERSION}"
|
||||
|
||||
- name: Update latest tag
|
||||
run: |
|
||||
curl -sS -X PUT \
|
||||
-H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"http://gitea.hal9000.home/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/linux-amd64/ratatoskr" \
|
||||
--data-binary @ratatoskr
|
||||
echo "Updated 'latest' tag"
|
||||
Reference in New Issue
Block a user