-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nix: static builds and release workflow (#1133)
* flake.nix: static build support Adds a "redistributable" flavor of Echidna that is fully static on Linux, and mostly static on macOS. * ci: add Nix & release workflow Replaces previous Nix workflow * ci: release: add job timeouts * ci: release: configure Cachix * README: update echidna-bundle references to echidna-redistributable * Fix TERMINFO path for Nix release builds on Linux ncurses in Nix is built with a TERMINFO path that references `/nix`. This causes the binaries fail when ran on non-nix systems, unless TERMINFO=/usr/share/terminfo is exported. This patches the binaries to use a more sensible default TERMINFO path. See also commit f76a7f4 * flake.nix: remove redundant stripping
- Loading branch information
Showing
4 changed files
with
190 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: "Nix and release" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
nixBuild: | ||
name: Build ${{ matrix.name }} binary | ||
timeout-minutes: ${{ matrix.timeout || 30 }} | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: read | ||
outputs: | ||
version: ${{ steps.version.outputs.version }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
name: Linux (x86_64) | ||
tuple: x86_64-linux | ||
timeout: 180 | ||
- os: macos-latest | ||
name: macOS (x86_64) | ||
tuple: x86_64-macos | ||
- os: macos-latest-xlarge | ||
name: macOS (aarch64) | ||
tuple: aarch64-macos | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v6 | ||
|
||
- name: Configure Cachix | ||
uses: cachix/cachix-action@v12 | ||
with: | ||
name: trailofbits | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: Configure Nix cache | ||
if: runner.arch == 'X64' | ||
# Unfortunately the action does not work on ARM runners | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
with: | ||
upstream-cache: https://trailofbits.cachix.org | ||
|
||
- name: Obtain version number | ||
id: version | ||
run: | | ||
if [[ "$GIT_REF" =~ ^refs/tags/v.* ]]; then | ||
echo "version=$(echo "$GIT_REF" | sed 's#^refs/tags/v##')" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "version=HEAD-$(echo "$GIT_SHA" | cut -c1-7)" >> "$GITHUB_OUTPUT" | ||
fi | ||
env: | ||
GIT_REF: ${{ github.ref }} | ||
GIT_SHA: ${{ github.sha }} | ||
|
||
- name: Build dynamic echidna | ||
run: | | ||
nix build .#echidna | ||
- name: Build redistributable echidna | ||
run: | | ||
nix build .#echidna-redistributable --out-link redistributable | ||
tar -czf "echidna-${{ steps.version.outputs.version }}-${{ matrix.tuple }}.tar.gz" -C ./redistributable/bin/ echidna | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: echidna-redistributable | ||
path: echidna-${{ steps.version.outputs.version }}-${{ matrix.tuple }}.tar.gz | ||
|
||
release: | ||
name: Create release | ||
timeout-minutes: 10 | ||
needs: [nixBuild] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download binaries | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: echidna-redistributable | ||
|
||
- name: Sign binaries | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: ./echidna-*.tar.gz | ||
|
||
- name: Create GitHub release and upload binaries | ||
uses: softprops/[email protected] | ||
with: | ||
draft: true | ||
name: "Echidna ${{ needs.nixBuild.outputs.version }}" | ||
files: | | ||
./echidna-*.tar.gz | ||
./echidna-*.tar.gz.sigstore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters