mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
Migrate CI from Cirrus CI to GitHub Actions (#447)
* Migrate CI to GitHub Actions * Publish Orchard through the OpenAI Homebrew tap * Scope release secrets to GoReleaser steps * Separate release and snapshot trust paths * Use GitHub-hosted macOS 26 runner * Run macOS unit tests on hosted runner * Update Homebrew install command * Build Docker image with GoReleaser * Use GitHub-hosted Linux runner * Use smaller Vetu image for Linux tests * Run Linux tests on hosted ARM runner * Use host architecture for Linux integration tests * Preinstall Cloud Hypervisor for Linux tests * Select Linux test images by architecture * Satisfy platform image lint rules * Format platform image errors * Enable KVM access for Linux tests * Honor VM wait time in WebSocket requests * Satisfy WebSocket client lint rules * Allow hosted Linux integration tests more time
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
merge_group:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.12.0
|
||||
only-new-issues: true
|
||||
|
||||
test-linux:
|
||||
name: Test (Linux)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Check out Vetu
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: openai/vetu
|
||||
path: _vetu
|
||||
- name: Build Vetu
|
||||
working-directory: _vetu
|
||||
run: |
|
||||
go build -o "$RUNNER_TEMP/vetu" cmd/vetu/main.go
|
||||
sudo setcap cap_net_raw,cap_net_admin+eip "$RUNNER_TEMP/vetu"
|
||||
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
|
||||
- name: Install Cloud Hypervisor
|
||||
run: |
|
||||
curl --fail --location --retry 3 \
|
||||
--output "$RUNNER_TEMP/cloud-hypervisor" \
|
||||
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/latest/download/cloud-hypervisor-static
|
||||
chmod +x "$RUNNER_TEMP/cloud-hypervisor"
|
||||
- name: Enable KVM access
|
||||
run: sudo chmod 0666 /dev/kvm
|
||||
- name: Pre-pull default Vetu image
|
||||
run: vetu pull ghcr.io/cirruslabs/ubuntu-amd64:24.04
|
||||
- name: Run tests
|
||||
run: go test -timeout=30m -v -count=1 ./...
|
||||
|
||||
test-macos:
|
||||
name: Test (macOS)
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run unit tests
|
||||
run: go list ./... | grep -v '/internal/tests' | xargs go test -timeout=20m -ldflags="-B gobuildid" -v -count=1
|
||||
@@ -1,24 +0,0 @@
|
||||
name: Main
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test (Linux)
|
||||
runs-on: ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: stable
|
||||
- name: Install Vetu
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get -y install apt-transport-https ca-certificates
|
||||
echo "deb [trusted=yes] https://apt.fury.io/cirruslabs/ /" | sudo tee /etc/apt/sources.list.d/cirruslabs.list
|
||||
sudo apt-get update && sudo apt-get -y install vetu
|
||||
- name: Pre-pull default Vetu image for use in tests
|
||||
run: |
|
||||
vetu pull ghcr.io/cirruslabs/ubuntu-runner-amd64:latest
|
||||
- name: Run tests
|
||||
run: go test -v -count=1 ./...
|
||||
@@ -0,0 +1,93 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release Binaries
|
||||
if: github.ref_type == 'tag'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
environment: publish
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- uses: docker/setup-qemu-action@v4
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
- name: Create release app token for this repo
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||
with:
|
||||
app-id: ${{ secrets.RELEASE_APP_ID }}
|
||||
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
|
||||
permission-contents: write
|
||||
- name: Create release app token for homebrew-tools
|
||||
id: tap-token
|
||||
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||
with:
|
||||
app-id: ${{ secrets.RELEASE_APP_ID }}
|
||||
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
|
||||
owner: openai
|
||||
repositories: homebrew-tools
|
||||
permission-contents: write
|
||||
permission-pull-requests: write
|
||||
- name: Release
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.tap-token.outputs.token }}
|
||||
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
|
||||
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
|
||||
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
|
||||
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
|
||||
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
|
||||
|
||||
snapshot:
|
||||
name: Release Binaries (Dry Run)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Release dry run
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: "~> v2"
|
||||
args: release --skip=publish --snapshot --clean
|
||||
- name: Upload dry-run artifacts
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: orchard-snapshot
|
||||
path: dist/**
|
||||
Reference in New Issue
Block a user