Skip to content

Fetch binaries in parallel #34

Fetch binaries in parallel

Fetch binaries in parallel #34

Workflow file for this run

name: check
on:
push:
branches: [main]
tags:
- "*"
pull_request:
branches: [main]
jobs:
mac-build:
runs-on: depot-macos-latest
env:
# TODO: save/restore
BEARDIST_CACHE_DIR: /tmp/beardist-cache
BEARDIST_ARTIFACT_NAME: aarch64-apple-darwin
GH_READWRITE_TOKEN: ${{ secrets.GH_READWRITE_TOKEN }}
CLICOLOR: 1
CLICOLOR_FORCE: 1
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Restore cache
uses: actions/cache@v3
with:
path: /tmp/beardist-cache
key: ${{ runner.os }}-${{ matrix.artifact }}-beardist-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.artifact }}-beardist-
- name: Download beardist
run: |
curl -L -o beardist.tar.xz https://github.com/bearcove/beardist/releases/download/v1.0.2/aarch64-apple-darwin.tar.xz
tar -xf beardist.tar.xz
chmod +x beardist
sudo mv beardist /usr/local/bin/
- name: Install cargo-binstall and other tools
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall -y cargo-sweep cargo-nextest
- name: Build
shell: bash
run: |
beardist build
linux-build:
strategy:
matrix:
include:
- runs-on: depot-ubuntu-24.04-16
platform: linux/amd64
artifact: x86_64-unknown-linux-gnu
- runs-on: depot-ubuntu-24.04-arm-16
artifact: aarch64-unknown-linux-gnu
platform: linux/arm64
runs-on: ${{ matrix.runs-on }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_READWRITE_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
shell: bash
run: |
docker buildx bake --set "*.platform=${{ matrix.platform }}" --set "*.tags=ghcr.io/bearcove/beardist:${{ matrix.platform == 'linux/arm64' && 'arm64' || 'amd64' }}-latest"
multi-platform-manifest:
needs: [linux-build]
runs-on: depot-ubuntu-24.04-4
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_READWRITE_TOKEN }}
- name: Create and push multi-platform manifest
run: |
docker buildx imagetools create -t ghcr.io/bearcove/beardist:latest \
ghcr.io/bearcove/beardist:amd64-latest \
ghcr.io/bearcove/beardist:arm64-latest
trigger-formula-update:
needs: [mac-build, linux-build]
if: startsWith(github.ref, 'refs/tags/')
runs-on: depot-ubuntu-24.04-2
env:
GH_READWRITE_TOKEN: ${{ secrets.GH_READWRITE_TOKEN }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Trigger formula update
run: |
curl -f -X POST \
-H "Authorization: token $GH_READWRITE_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"ref": "main", "inputs": {"repository": "'$GITHUB_REPOSITORY'"}}' \
https://api.github.com/repos/bearcove/tap/actions/workflows/bump.yml/dispatches