CI runs on GitHub Actions

- on a self-hosted runner
- pull requests don't trigger actions (security)
- forks don't trigger actions (security)
- run in a container (fedora-golang-bosh) (security)
This commit is contained in:
Brian Cunnie
2025-01-18 19:13:07 -08:00
parent 6027636bbd
commit 4d6adde5a9

View File

@@ -3,39 +3,28 @@ name: CI
on: on:
push: push:
branches: [ main ] branches: [ main ]
pull_request:
branches: [ main ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest # Only run on main repo, not forks
if: github.repository == 'cunnie/sslip.io'
runs-on: self-hosted
container: cunnie/fedora-golang-bosh
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build
run: go build -v ./...
- name: Test - name: Test
run: go test -v ./... run: ginkgo -r -p .
release: release:
needs: build needs: build
runs-on: ubuntu-latest runs-on: self-hosted
if: github.event_name == 'push' && github.ref == 'refs/heads/main' container: cunnie/fedora-golang-bosh
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'cunnie/sslip.io'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build Release Binary - name: Build Release Binary
run: | run: |
GOOS=linux GOARCH=amd64 go build -o sslip-linux-amd64 GOOS=linux GOARCH=amd64 go build -o sslip-linux-amd64