diff --git a/.gitea/workflows/pr-checks.yml b/.gitea/workflows/pr-checks.yml new file mode 100644 index 0000000..b8b8527 --- /dev/null +++ b/.gitea/workflows/pr-checks.yml @@ -0,0 +1,70 @@ +name: PR Checks + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + checks: + runs-on: ubuntu-latest + container: + image: golang:1.26-alpine + env: + CGO_ENABLED: "0" + steps: + - name: Install toolchain deps + run: apk add --no-cache nodejs npm git tar + + - uses: actions/checkout@v4 + + - name: Cache npm downloads + uses: actions/cache@v4 + with: + path: ~/.npm + key: npm-${{ hashFiles('frontend/package-lock.json') }} + restore-keys: npm- + + - name: Cache Go modules and build cache + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: go-${{ hashFiles('go.sum') }}-${{ hashFiles('**/*.go') }} + restore-keys: | + go-${{ hashFiles('go.sum') }}- + go- + + - name: Install frontend dependencies + working-directory: frontend + run: npm ci + + - name: Type-check and build frontend + working-directory: frontend + run: | + npx vue-tsc -b + npx vite build --outDir ../internal/server/static --emptyOutDir + + - name: Check Go formatting + run: | + unformatted="$(gofmt -l .)" + if [ -n "$unformatted" ]; then + echo "These files are not gofmt-formatted:" + echo "$unformatted" + exit 1 + fi + + - name: Verify go.mod is tidy + run: | + go mod tidy + git diff --exit-code go.mod go.sum + + - name: Vet + run: go vet ./... + + - name: Build + run: go build ./... + + - name: Test + run: go test ./...