style(nix): apply treefmt
formatting
#52
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '.github/assets/**' | |
- '.github/dependabot.yml' | |
- 'LICENSE' | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
actions: write | |
jobs: | |
ci: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_FEATURES: ${{ matrix.features }} | |
strategy: | |
fail-fast: false | |
matrix: | |
features: ['blog', ''] | |
runner: [ubuntu-22.04, ubuntu-22.04-arm] | |
name: CI - ${{ matrix.runner }}${{ matrix.features != '' && format(' ({0})', matrix.features) || '' }} | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install nix | |
uses: nixbuild/nix-quick-install-action@v33 | |
- name: Update nix channels | |
run: | | |
nix-channel --add https://nixos.org/channels/nixpkgs-unstable | |
nix-channel --update | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v6 | |
id: nix-cache | |
with: | |
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | |
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}- | |
gc-max-store-size-linux: 5368709000 | |
purge: true | |
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}- | |
purge-created: 0 | |
purge-primary-key: never | |
- name: Lint and check code | |
run: nix flake check | |
# FIXME: Once we centralize docker building into our nix flake, we should update the features matrix | |
# to instead refer to the nix attributes in `default.nix` | |
- name: Build project | |
run: nix build --file . ssh-portfolio${CARGO_FEATURES:+-$CARGO_FEATURES} | |
- name: Build docker image | |
run: nix develop -c docker build -t ssh-portfolio --build-arg CARGO_FEATURES=$CARGO_FEATURES . |