Skip to content

[release] [fix] add missing cloudflare env vars #934

[release] [fix] add missing cloudflare env vars

[release] [fix] add missing cloudflare env vars #934

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go build, test and coverage
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: Generate templ code
uses: './.github/actions/templ_generate'
with:
templ-version: 'v0.2.793'
setup-go: 'false'
commit: 'false'
- name: Install dependencies
run: |
go get ./...
- name: Generate Cloudflare locations Go file
uses: './.github/actions/generate_cloudflare_locations_file'
- name: Build Go binaries
run: go build -v ./...
- name: Run Go tests
run: go test ./...
- name: Run tests and generate coverage
run: |
go test -v -coverprofile=coverage.out ./functions/...
go tool cover -func=coverage.out | tee coverage.txt
cat coverage.txt # Echo coverage for debugging
- name: Check coverage
run: |
COVERAGE=$(awk -F'[[:space:]]+' '/^total:/ {print $NF+0}' coverage.txt)
echo "Total coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 45" | bc -l) )); then
echo "🔴 Coverage is $COVERAGE%. We require minimum 45%."
exit 1
elif (( $(echo "$COVERAGE < 60" | bc -l) )); then
echo "🟠 Coverage is $COVERAGE%. It's passing but is close to the failure cutoff."
else
echo "🟢 Coverage is $COVERAGE%. We're good!"
fi