diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fc2d168 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Testing + +on: + pull_request: + push: + branches: + - master + +jobs: + + tests: + name: Run tests + runs-on: ubuntu-latest + + steps: + + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: recursive + + # We use nix flakes to setup environment + - name: Install Nix + uses: cachix/install-nix-action@v17 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + + - name: Test + run: | + nix develop .#test --command meson test -C build --print-errorlogs diff --git a/flake.nix b/flake.nix index f1ae17c..9edd8a0 100644 --- a/flake.nix +++ b/flake.nix @@ -65,12 +65,13 @@ hardeningDisable = [ "fortify" ]; }; - tests = pkgs.mkShell rec { + test = pkgs.mkShell rec { nativeBuildInputs = with pkgs; [ # Bulding gnumake ninja meson + nasm # Testing criterion.out criterion.dev @@ -79,6 +80,11 @@ LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs; hardeningDisable = [ "fortify" ]; + + shellHook = '' + export BUILD_DIR=build + meson setup --cross-file ./scripts/meson_cross.ini --reconfigure -Dbuildtype=debug "./$BUILD_DIR" + ''; }; };