ci: new workflow for forgejo
This commit is contained in:
parent
3cf8a9e38c
commit
519cfcf7b7
1 changed files with 71 additions and 0 deletions
71
.forgejo/workflows/build.yml
Normal file
71
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checks:
|
||||||
|
name: Checks
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: golang:1.23
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Run go fmt and go vet
|
||||||
|
run: |
|
||||||
|
go fmt $(go list ./...)
|
||||||
|
go vet $(go list ./...)
|
||||||
|
|
||||||
|
code-coverage:
|
||||||
|
name: Code Coverage
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: golang:1.23
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Run tests and generate coverage report
|
||||||
|
run: |
|
||||||
|
go test -covermode=count -coverprofile coverage.cov $(go list ./...)
|
||||||
|
go tool cover -func=coverage.cov
|
||||||
|
go tool cover -html=coverage.cov -o coverage.html
|
||||||
|
- name: Upload coverage artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage-reports
|
||||||
|
path: |
|
||||||
|
coverage.cov
|
||||||
|
coverage.html
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: golang:1.23
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go:
|
||||||
|
- GOOS: darwin
|
||||||
|
GOARCH: amd64
|
||||||
|
- GOOS: darwin
|
||||||
|
GOARCH: arm64
|
||||||
|
- GOOS: linux
|
||||||
|
GOARCH: amd64
|
||||||
|
- GOOS: linux
|
||||||
|
GOARCH: arm64
|
||||||
|
- GOOS: windows
|
||||||
|
GOARCH: amd64
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set environment variables
|
||||||
|
run: |
|
||||||
|
echo "GOOS=${{ matrix.go.GOOS }}" >> $GITHUB_ENV
|
||||||
|
echo "GOARCH=${{ matrix.go.GOARCH }}" >> $GITHUB_ENV
|
||||||
|
- name: Build
|
||||||
|
run: go build .
|
Loading…
Add table
Reference in a new issue