Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: use Nix in CI. #14

Merged
1 commit merged into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 18 additions & 32 deletions .github/workflows/zig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,22 @@ on:
pull_request:

jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
- run: zig build
- run: zig build test
test-macos:
runs-on: macos-latest
test-nix:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
- run: brew install pcre
- run: zig build
- run: zig build test
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix build -L
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
Expand All @@ -45,10 +32,9 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
- run: zig fmt --check build.zig src/*.zig
- uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix develop --command zig fmt --check src/*.zig
16 changes: 14 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
in rec {
formatter = pkgs.alejandra;
packages.default = pkgs.stdenv.mkDerivation {
name = "libpcre.zig-build";

src = ./.;

devShells.default = pkgs.mkShell {
nativeBuildInputs = [pkgs.zig pkgs.pcre];

buildPhase = ''
export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig"
zig build test
touch $out
'';

dontInstall = true;
};

formatter = pkgs.alejandra;
});
}
Loading