feat(ci): add CI workflow e2e test with cold/warm builds
Some checks failed
Go CI with S3 Caching / build-and-test (push) Failing after 1m5s

This commit is contained in:
2026-05-19 21:07:46 -07:00
parent 0ddbcd4222
commit 3bba1d1cd8
2 changed files with 66 additions and 0 deletions

56
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,56 @@
name: Go CI with S3 Caching
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Add SSH known host
run: |
install -m 700 -d "$HOME/.ssh"
ssh-keyscan -H git.ericxliu.me > $HOME/.ssh/known_hosts
- name: Checkout code
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_KEY }}
- name: Setup Go + S3 Caching
uses: ./.gitea/actions/go-cache
with:
go-version: '1.24'
s3-bucket: sccache
s3-endpoint: https://s3.ericxliu.me
s3-path-style: "true"
env:
SCCACHE_AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_AWS_ACCESS_KEY_ID }}
SCCACHE_AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: auto
- name: Clean Local Go Cache (Start Fresh)
run: |
echo "Clearing local cache..."
go clean -cache
- name: Cold Build (Cache Miss / Populates S3)
run: |
echo "Running cold build..."
time go build -o test-binary main.go
- name: Clean Local Go Cache (Forces Remote Fetch)
run: |
echo "Clearing local cache to force remote S3 fetch..."
go clean -cache
- name: Warm Build (Cache Hit / Fetches from S3)
run: |
echo "Running warm build..."
time go build -o test-binary main.go
- name: Run Test Binary
run: ./test-binary

10
main.go Normal file
View File

@@ -0,0 +1,10 @@
package main
import (
"fmt"
"time"
)
func main() {
fmt.Printf("Hello, Gitea Actions with Go caching on S3! Built at: %s\n", time.Now().Format(time.RFC3339))
}