Prepare to distribute codd as a macOS app bundle #468
Workflow file for this run
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 is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
defaults: | |
run: | |
shell: bash # Implies `set -eo pipefail`, among other things. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell | |
env: | |
CI: 1 | |
jobs: | |
build-x86_64-linux: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: jlumbroso/[email protected] | |
with: | |
tool-cache: true | |
- uses: cachix/install-nix-action@v24 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.8.1/install | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
substituters = https://cache.nixos.org https://mzabani.cachix.org https://cache.iog.io | |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= mzabani.cachix.org-1:wnkKakfl+rbT7zTtV1P1tAtjBTuh6GQVX7LfSd9sMbA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: mzabani | |
skipPush: false | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
# Wish this could be done, but there's a permissions problem. See https://github.com/actions/cache/issues/133 | |
# - name: Nix Store Caching | |
# uses: actions/cache@v2 | |
# with: | |
# path: /nix/ | |
# key: ${{ runner.os }}-build | |
- name: Build statically linked codd | |
run: nix build --no-link ".#x86_64-unknown-linux-musl:codd:exe:codd" | |
- name: Build statically linked codd's tests | |
run: nix build --no-link ".#x86_64-unknown-linux-musl:codd:test:codd-test" | |
- name: Build statically linked benchmarks | |
run: nix build --no-link ".#x86_64-unknown-linux-musl:codd:bench:codd-bench" | |
- name: Build executable used for installer | |
run: nix-build --no-out-link ./nix/install-codd-nixpkgs.nix -A codd | |
- name: Install codd with nix-env and uninstall it | |
run: | | |
nix-env -f ./nix/install-codd-nixpkgs.nix -iA codd | |
codd --help | |
nix-env --uninstall codd | |
- name: Run tests | |
run: nix develop .#shellWithRunfile.x86_64-linux -c run ci-tests | |
- name: Run benchmarks | |
run: nix run ".#x86_64-unknown-linux-musl:codd:bench:codd-bench" | |
- name: Build codd's library's haddocks | |
run: nix build --no-link ".#x86_64-unknown-linux-musl:codd:lib:codd.doc" | |
- name: Build codd's docker image | |
run: nix build --no-link .#dockerImage.x86_64-linux | |
build-aarch64-darwin: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Recover disk space | |
run: | | |
df -h | |
ls /Applications | |
brew uninstall google-chrome | |
sudo rm -rf /Users/runner/Library/Android | |
sudo rm -rf /Applications/Xcode* | |
sudo rm -rf /Applications/Python* | |
ls /Applications | |
df -h | |
- uses: cachix/install-nix-action@v24 | |
with: | |
install_url: https://releases.nixos.org/nix/nix-2.8.1/install | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
substituters = https://cache.nixos.org https://mzabani.cachix.org https://cache.iog.io | |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= mzabani.cachix.org-1:wnkKakfl+rbT7zTtV1P1tAtjBTuh6GQVX7LfSd9sMbA= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: mzabani | |
skipPush: false | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
# Statically linking in macOS seems hard at this time. Also, app bundles seem relatively easy to produce | |
# and are a standard for macOS app distribution. | |
- name: Build codd without static linking | |
run: nix build --no-link ".#codd:exe:codd" | |
- name: Create macOS app bundle | |
run: | | |
nix build .#coddDarwinAppBundle.aarch64-darwin | |
unzip -l result/codd.zip | |
unzip result/codd.zip -d extracted-bundle | |
./extracted-bundle/codd.app/Contents/MacOS/codd --help # A smoke test | |
- name: Install codd with nix-env and uninstall it | |
run: | | |
nix-env -f ./nix/install-codd-nixpkgs.nix -iA codd | |
codd --help | |
nix-env --uninstall codd | |