Files
actions-go/.gitea/workflows/ci.yml
Eric Liu c4227a0eb1
All checks were successful
Go CI with S3 Caching / build-and-test (push) Successful in 1m22s
fix(s3): use us-east-1 region and force S3 cache fetch in CI
2026-05-19 21:19:10 -07:00

59 lines
1.6 KiB
YAML

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: us-east-1
- name: Clean Local Go Cache (Start Fresh)
run: |
echo "Clearing local cache..."
go clean -cache
rm -rf ~/.cache/go-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
rm -rf ~/.cache/go-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