Migrate CI to GitHub Actions
This commit is contained in:
parent
87b0e2d9c8
commit
5d9fe507f1
91
.cirrus.yml
91
.cirrus.yml
|
|
@ -1,91 +0,0 @@
|
|||
task:
|
||||
name: Lint
|
||||
container:
|
||||
image: golangci/golangci-lint:latest
|
||||
cpu: 2
|
||||
memory: 4096
|
||||
prepare_script:
|
||||
- apt-get update
|
||||
- apt-get install -y libx11-dev
|
||||
lint_script:
|
||||
- golangci-lint run -v --output.json.path golangci.json
|
||||
always:
|
||||
report_artifacts:
|
||||
path: golangci.json
|
||||
type: text/json
|
||||
format: golangci
|
||||
|
||||
task:
|
||||
name: Test (Linux)
|
||||
alias: Tests
|
||||
container:
|
||||
image: golang:latest
|
||||
|
||||
prepare_script:
|
||||
- apt-get update
|
||||
- apt-get install -y libx11-dev
|
||||
test_script: go test -v ./...
|
||||
|
||||
task:
|
||||
name: Test (macOS)
|
||||
alias: Tests
|
||||
macos_instance:
|
||||
image: ghcr.io/cirruslabs/macos-runner:sequoia
|
||||
|
||||
prepare_script: brew install go
|
||||
test_script: go test -v ./...
|
||||
|
||||
task:
|
||||
name: Check for lacking "buf generate" invocation
|
||||
|
||||
container:
|
||||
image: golang:latest
|
||||
|
||||
install_buf_script: go install github.com/bufbuild/buf/cmd/buf@v1.50.0
|
||||
generate_script: buf generate
|
||||
check_script: git diff --exit-code
|
||||
|
||||
task:
|
||||
only_if: $CIRRUS_BRANCH != '' && $CIRRUS_PR == '' && $CIRRUS_REPO_OWNER == 'cirruslabs'
|
||||
name: buf push
|
||||
|
||||
container:
|
||||
image: bufbuild/buf
|
||||
|
||||
login_script: echo "$BUF_TOKEN" | buf registry login --token-stdin
|
||||
push_script: buf push --git-metadata
|
||||
|
||||
env:
|
||||
BUF_TOKEN: ENCRYPTED[!8ee7eb2504cc84b08d4a7c0dacbe103640b1feaa26d06f0df010784e872d39e65a0cdea3fc7c09b065a917a77113b96b!]
|
||||
|
||||
task:
|
||||
name: Release (Dry Run)
|
||||
only_if: $CIRRUS_TAG == ''
|
||||
macos_instance:
|
||||
image: ghcr.io/cirruslabs/macos-runner:sequoia
|
||||
depends_on:
|
||||
- Lint
|
||||
- Tests
|
||||
install_script:
|
||||
- brew install go
|
||||
- brew install --cask goreleaser/tap/goreleaser-pro
|
||||
release_script: goreleaser release --clean --snapshot
|
||||
goreleaser_artifacts:
|
||||
path: "dist/**"
|
||||
|
||||
task:
|
||||
name: Release
|
||||
only_if: $CIRRUS_TAG != ''
|
||||
macos_instance:
|
||||
image: ghcr.io/cirruslabs/macos-runner:sequoia
|
||||
depends_on:
|
||||
- Lint
|
||||
- Tests
|
||||
env:
|
||||
GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!]
|
||||
FURY_TOKEN: ENCRYPTED[!97fe4497d9aca60a3d64904883b81e21f19706c6aedda625c97f62f67ec46b8efa74c55699956158bbf0a23726e7d9f6!]
|
||||
GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!]
|
||||
install_script:
|
||||
- brew install go
|
||||
- brew install --cask goreleaser/tap/goreleaser-pro
|
||||
release_script: goreleaser
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
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
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install --yes libx11-dev
|
||||
- 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: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install --yes libx11-dev
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
|
||||
test-macos:
|
||||
name: Test (macOS)
|
||||
runs-on: ghcr.io/cirruslabs/macos-runner:sequoia
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
|
||||
generated-code:
|
||||
name: Check generated code
|
||||
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
|
||||
- name: Install Buf
|
||||
run: go install github.com/bufbuild/buf/cmd/buf@v1.50.0
|
||||
- name: Generate code
|
||||
run: buf generate
|
||||
- name: Check for changes
|
||||
run: git diff --exit-code
|
||||
|
||||
buf-push:
|
||||
name: Push Buf module
|
||||
if: github.event_name == 'push' && github.repository_owner == 'openai'
|
||||
needs: generated-code
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Install Buf
|
||||
run: go install github.com/bufbuild/buf/cmd/buf@v1.50.0
|
||||
- name: Log in to Buf
|
||||
run: echo "$BUF_TOKEN" | buf registry login --token-stdin
|
||||
env:
|
||||
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
|
||||
- name: Push module
|
||||
run: buf push --git-metadata
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: ${{ github.ref_type == 'tag' && 'Release' || 'Release (Dry Run)' }}
|
||||
runs-on: ghcr.io/cirruslabs/macos-runner:sequoia
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Release
|
||||
if: github.ref_type == 'tag'
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
- name: Release dry run
|
||||
if: github.ref_type != 'tag'
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: "~> v2"
|
||||
args: release --skip=publish --snapshot --clean
|
||||
- name: Upload dry-run artifacts
|
||||
if: github.ref_type != 'tag'
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: tart-guest-agent-snapshot
|
||||
path: dist/**
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
version: 2
|
||||
version: "2"
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
linters-settings:
|
||||
# Even in Rust you can get away with partial matching,
|
||||
# so make sure that the linter respects the programmer's
|
||||
# intent expressed in the form of "default" case.
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
default: all
|
||||
|
||||
settings:
|
||||
# Even in Rust you can get away with partial matching,
|
||||
# so make sure that the linter respects the programmer's
|
||||
# intent expressed in the form of "default" case.
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
|
||||
disable:
|
||||
# We don't have high-performance requirements at this moment, so sacrificing
|
||||
|
|
|
|||
|
|
@ -53,32 +53,7 @@ brews:
|
|||
repository:
|
||||
owner: cirruslabs
|
||||
name: homebrew-cli
|
||||
homepage: https://github.com/cirruslabs/tart-guest-agent
|
||||
homepage: https://github.com/openai/tart-guest-agent
|
||||
license: FSL-1.1-Apache-2.0
|
||||
description: Guest agent for Tart VMs
|
||||
skip_upload: auto
|
||||
|
||||
nfpms:
|
||||
- package_name: "{{ .ProjectName }}"
|
||||
vendor: Cirrus Labs, Inc.
|
||||
homepage: https://github.com/cirruslabs/tart-guest-agent
|
||||
maintainer: support@cirruslabs.org
|
||||
description: Guest agent for Tart VMs
|
||||
section: misc
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
||||
- rpm
|
||||
contents:
|
||||
- src: packaging/tart-guest-agent.service
|
||||
dst: /etc/systemd/system/tart-guest-agent.service
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
scripts:
|
||||
postinstall: packaging/postinstall.sh
|
||||
preremove: packaging/preremove.sh
|
||||
postremove: packaging/postremove.sh
|
||||
|
||||
furies:
|
||||
- account: cirruslabs
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set shell options to enable fail-fast behavior
|
||||
#
|
||||
# * -e: fail the script when an error occurs or command fails
|
||||
# * -u: fail the script when attempting to reference unset parameters
|
||||
# * -o pipefail: by default an exit status of a pipeline is that of its
|
||||
# last command, this fails the pipe early if an error in
|
||||
# any of its commands occurs
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable tart-guest-agent.service
|
||||
systemctl start tart-guest-agent.service
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set shell options to enable fail-fast behavior
|
||||
#
|
||||
# * -e: fail the script when an error occurs or command fails
|
||||
# * -u: fail the script when attempting to reference unset parameters
|
||||
# * -o pipefail: by default an exit status of a pipeline is that of its
|
||||
# last command, this fails the pipe early if an error in
|
||||
# any of its commands occurs
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
systemctl daemon-reload
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set shell options to enable fail-fast behavior
|
||||
#
|
||||
# * -e: fail the script when an error occurs or command fails
|
||||
# * -u: fail the script when attempting to reference unset parameters
|
||||
# * -o pipefail: by default an exit status of a pipeline is that of its
|
||||
# last command, this fails the pipe early if an error in
|
||||
# any of its commands occurs
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
systemctl stop tart-guest-agent.service
|
||||
systemctl disable tart-guest-agent.service
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
[Unit]
|
||||
Description=Guest agent for Tart VMs
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=admin
|
||||
ExecStart=tart-guest-agent --run-rpc
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Reference in New Issue