# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT name: test on: push: workflow_dispatch: jobs: test: runs-on: nixos-do-s steps: - name: Check out uses: https://code.forgejo.org/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Check REUSE compliance run: nix develop -c reuse lint # `zig-pkg` is where Zig puts fetched dependencies, and it is full of # other people's source. It does not exist yet on a fresh checkout, but # it does as soon as anything has been built, so excluding it is what # makes this command mean the same thing here and on a developer's # machine. - name: Check Zig formatting compliance run: nix develop -c zig fmt --check --exclude zig-pkg . - name: Test run: nix develop -c zig build test --summary all - name: Build run: nix develop -c zig build # Nothing else builds the fuzz driver or the docs server, so without # this they could stop compiling and the test step would not notice. - name: Build everything that is not built by the steps above run: nix develop -c zig build check # Bounded by a count rather than a clock so that the run is the same on # every machine, and short because this is here to catch a property that # a change has made false rather than to search: a real campaign is # `zig build fuzz-run -- --seconds 600` on somebody's own machine. - name: Fuzz the parsers run: nix develop -c zig build fuzz-run -- --iterations 500000 # The interoperability test boots a NixOS guest to run a real Dovecot # against a maildir this library wrote, so it needs a runner that can nest # virtualisation. The ephemeral DigitalOcean tiers can; the always-on one # deliberately cannot. interop: runs-on: nixos-do-s steps: - name: Check out uses: https://code.forgejo.org/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Dovecot reads what this library writes run: nix flake check --print-build-logs # Published only from main, so that a branch build cannot replace the site # with a work in progress, and only after `test` has passed, so that it # cannot document a tree that does not compile. docs: needs: test if: ${{ forge.ref == 'refs/heads/main' }} runs-on: nixos-do-s steps: - name: Check out uses: https://code.forgejo.org/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Build API docs run: nix develop -c zig build docs - name: Publish docs run: > nix develop -c git-pages-cli https://jeff.jcollie.page/zig-maildir/ --server jcollie.page --token ${{ forge.token }} --upload-dir zig-out/docs