Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "reqwest_unstable"]
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: gomod
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
Expand Down
103 changes: 34 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,65 @@
name: ci

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
GO_VERSION: "1.26.3"
CARGO_TERM_COLOR: always

permissions:
contents: read

jobs:
check:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}

- name: Format
run: gofmt -s -w . && git diff --exit-code
fetch-depth: 0

- name: Mod download
run: go mod download
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt

- name: Tidy
run: go mod tidy && git diff --exit-code
- name: Rust format
run: cargo fmt --check

- name: Mod verify
run: go mod verify
- name: Rust lint
run: cargo clippy --locked --all-targets --all-features -- -D warnings

- name: Lint
uses: dominikh/staticcheck-action@v1.4.1
with:
version: "2026.1"
install-go: false
- name: Rust unit tests
run: cargo test --locked --all-features --bins

test:
integration:
name: integration (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Test
run: go test -v -parallel 8 ./...
- name: Install protoc (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

build:
runs-on: ubuntu-latest
strategy:
matrix:
build:
- linux-amd64
- linux-arm64
- darwin-amd64
- darwin-arm64
- windows-amd64
- windows-arm64
include:
- build: linux-amd64
goos: linux
goarch: amd64
- build: linux-arm64
goos: linux
goarch: arm64
- build: darwin-amd64
goos: darwin
goarch: amd64
- build: darwin-arm64
goos: darwin
goarch: arm64
- build: windows-amd64
goos: windows
goarch: amd64
- build: windows-arm64
goos: windows
goarch: arm64
steps:
- uses: actions/checkout@v6
- name: Install protoc (macOS)
if: runner.os == 'macOS'
run: brew install protobuf

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Install protoc (Windows)
if: runner.os == 'Windows'
run: choco install protoc -y

- name: Go build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go install -trimpath -ldflags="-s -w"
- name: Rust integration tests against Rust binary
run: cargo test --locked --all-features --test integration -- --test-threads=1
92 changes: 47 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,87 @@ on:
types: [published]

env:
GO_VERSION: "1.26.3"
CARGO_TERM_COLOR: always

permissions:
contents: read

jobs:
release:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
ASSET: ""
BIN_NAME: fetch
strategy:
matrix:
build:
- linux-amd64
- linux-arm64
- darwin-amd64
- darwin-arm64
- windows-amd64
- windows-arm64
include:
- build: linux-amd64
goos: linux
goarch: amd64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: tar.gz
- build: linux-arm64
goos: linux
goarch: arm64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: tar.gz
- build: darwin-amd64
goos: darwin
goarch: amd64
os: macos-latest
target: x86_64-apple-darwin
artifact: tar.gz
- build: darwin-arm64
goos: darwin
goarch: arm64
os: macos-latest
target: aarch64-apple-darwin
artifact: tar.gz
- build: windows-amd64
goos: windows
goarch: amd64
os: windows-latest
target: x86_64-pc-windows-msvc
artifact: zip
- build: windows-arm64
goos: windows
goarch: arm64
os: windows-latest
target: aarch64-pc-windows-msvc
artifact: zip
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
go-version: ${{ env.GO_VERSION }}
targets: ${{ matrix.target }}

- name: Set bin name
if: ${{ matrix.goos == 'windows' }}
run: echo "BIN_NAME=fetch.exe" >> $GITHUB_ENV
- name: Install Linux ARM64 linker
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Go build
- name: Rust build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go build -trimpath -ldflags="-s -w -buildid=" -o ${{ env.BIN_NAME }}
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
FETCH_VERSION: ${{ github.ref_name }}
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Build archive (unix)
if: ${{ matrix.goos != 'windows' }}
if: matrix.artifact == 'tar.gz'
shell: bash
run: |
staging="fetch-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}"
tar czf "$staging.tar.gz" fetch
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
staging="fetch-${{ github.ref_name }}-${{ matrix.build }}"
mkdir "$staging"
cp "target/${{ matrix.target }}/release/fetch" "$staging/fetch"
tar czf "$staging.tar.gz" -C "$staging" fetch
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"

- name: Build archive (windows)
if: ${{ matrix.goos == 'windows' }}
shell: bash
if: matrix.artifact == 'zip'
shell: pwsh
run: |
staging="fetch-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}"
zip "$staging.zip" fetch.exe
echo "ASSET=$staging.zip" >> $GITHUB_ENV
$staging = "fetch-${{ github.ref_name }}-${{ matrix.build }}"
New-Item -ItemType Directory -Path $staging | Out-Null
Copy-Item "target/${{ matrix.target }}/release/fetch.exe" "$staging/fetch.exe"
Compress-Archive -Path "$staging/fetch.exe" -DestinationPath "$staging.zip"
"ASSET=$staging.zip" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ github.ref_name }} ${{ env.ASSET }}
run: gh release upload ${{ github.ref_name }} ${{ env.ASSET }} --clobber

latest:
runs-on: "ubuntu-latest"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.claude
/bin
/scratch
/target
Loading
Loading