Skip to content

Commit 14a3ee2

Browse files
Migrate CI from Cirrus CI to GitHub Actions (#167)
* Migrate CI to GitHub Actions * Publish Softnet releases to homebrew-tools * Isolate Softnet release secrets
1 parent 943bd1e commit 14a3ee2

4 files changed

Lines changed: 143 additions & 71 deletions

File tree

.cirrus.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
18+
timeout-minutes: 30
19+
steps:
20+
- uses: actions/checkout@v6
21+
- name: Install Rust
22+
run: |
23+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
24+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
25+
- name: Install lint components
26+
run: rustup component add clippy rustfmt
27+
- name: Check formatting
28+
run: cargo fmt --check
29+
- name: Run Clippy
30+
run: cargo clippy --all-targets --all-features -- -D warnings
31+
32+
test:
33+
name: Test on macOS ${{ matrix.macos }}
34+
runs-on: ghcr.io/cirruslabs/macos-runner:${{ matrix.runner }}
35+
timeout-minutes: 30
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
include:
40+
- macos: Sequoia
41+
runner: sequoia
42+
- macos: Tahoe
43+
runner: tahoe
44+
steps:
45+
- uses: actions/checkout@v6
46+
- name: Install Rust
47+
run: |
48+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
49+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
50+
- name: Run tests
51+
run: cargo test

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
release:
14+
name: Release
15+
if: github.event_name == 'push' && github.ref_type == 'tag'
16+
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
17+
environment: publish
18+
timeout-minutes: 60
19+
steps:
20+
- uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
persist-credentials: false
24+
- name: Install Rust
25+
run: |
26+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
27+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
28+
- name: Install release targets
29+
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
30+
- name: Create release app token for this repo
31+
id: app-token
32+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
33+
with:
34+
app-id: ${{ secrets.RELEASE_APP_ID }}
35+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
36+
permission-contents: write
37+
- name: Create release app token for homebrew-tools
38+
id: tap-token
39+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
40+
with:
41+
app-id: ${{ secrets.RELEASE_APP_ID }}
42+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
43+
owner: openai
44+
repositories: homebrew-tools
45+
permission-contents: write
46+
permission-pull-requests: write
47+
- name: Release
48+
uses: goreleaser/goreleaser-action@v7
49+
with:
50+
distribution: goreleaser-pro
51+
version: "~> v2"
52+
args: release --clean
53+
env:
54+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
55+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.tap-token.outputs.token }}
56+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
57+
58+
snapshot:
59+
name: Release (Dry Run)
60+
if: github.event_name == 'workflow_dispatch'
61+
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
62+
timeout-minutes: 60
63+
steps:
64+
- uses: actions/checkout@v6
65+
with:
66+
fetch-depth: 0
67+
persist-credentials: false
68+
- name: Install Rust
69+
run: |
70+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
71+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
72+
- name: Install release targets
73+
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
74+
- name: Release dry run
75+
uses: goreleaser/goreleaser-action@v7
76+
with:
77+
distribution: goreleaser-pro
78+
version: "~> v2"
79+
args: release --skip=publish --snapshot --clean
80+
- name: Upload dry-run artifacts
81+
uses: actions/upload-artifact@v6
82+
with:
83+
name: softnet-snapshot
84+
path: dist/**

.goreleaser.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ release:
2323
brews:
2424
- name: "{{ .ProjectName }}"
2525
repository:
26-
owner: cirruslabs
27-
name: homebrew-cli
26+
owner: openai
27+
name: homebrew-tools
28+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
29+
branch: "softnet-{{ .Version }}"
30+
pull_request:
31+
enabled: true
32+
directory: Formula
2833
caveats: See the Github repository for more information
29-
homepage: https://github.com/cirruslabs/softnet
34+
homepage: https://github.com/openai/softnet
3035
description: Software networking with isolation for Tart
3136
skip_upload: auto
3237
custom_block: |

0 commit comments

Comments
 (0)