Skip to content
Open
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
97 changes: 97 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: "Run end-to-end tests for Nixie"

on:
push:
paths:
- 'src/**'
- 'nixie/**'
- 'sources/**'
- 'static-bins/**'
- 'tests/**'
- '*.nix'

jobs:
run-tests:
strategy:
# We need other architectures to succeed to generate full reports!
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm, macos-latest ]
cpu: [ x86_64, aarch64 ]
exclude:
- os: ubuntu-latest
cpu: aarch64
- os: ubuntu-24.04-arm
cpu: x86_64
name: Run unit tests
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Nix
uses: cachix/install-nix-action@v20
- name: Set up Cachix access
uses: cachix/cachix-action@v12
with:
name: nix-wrap
- name: Enable KVM group perms
if: matrix.os == 'ubuntu-latest'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Launch tests
run: |
for file in tests/features/*.feature
do
echo "::group::Test ${file##*/}"
feat="${file##*/}"
os="$(uname -s | tr ':[A-Z]:' ':[a-z]:')"
nix run .#checks.${{ matrix.cpu }}-${os}.${feat%%.feature}.driver
echo "::endgroup::"
done
- name: Save results
uses: actions/upload-artifact@v7
if: always()
with:
name: allure-output-${{ matrix.cpu }}-${{ matrix.os }}
path: allure_output

push-reports:
name: Upload HTML reports to Pages
needs: run-tests
if: always()
runs-on: ubuntu-latest
permissions:
statuses: write
contents: write
pages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Fetch report
uses: actions/download-artifact@v8
with:
pattern: allure-output-*
path: allure_output
merge-multiple: true
- name: Deploy report to GitHub Pages
id: report
uses: PavanMudigonda/html-reporter-github-pages@v1.5.21
with:
test_results: allure_output
allure_report_generate_flag: true
keep_reports: 10
gh_pages: pages_reports
workflow_name: ${{ github.workflow }}
use_actions_summary: true
- name: Notify about generated report
uses: guibranco/github-status-action-v2@v1.1.14
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: Nixie test reports
description: Click here to open test reports
state: success
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: ${{env.GITHUB_PAGES_WEBSITE_URL}}/${{github.run_member}}/index.html

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
features
*.tgz
*.tar.gz
.nixie
Expand Down
43 changes: 39 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{ description = "Put Nix in everything!";

inputs.nixpkgs.url = github:nixos/nixpkgs;
inputs.amber.url = github:amber-lang/amber;
inputs.nix.url = github:nixos/nix/2.26.2;
inputs.fakedir =
{ url = github:nixie-dev/fakedir;
inputs = {
nixpkgs.url = github:nixos/nixpkgs;
amber.url = github:amber-lang/amber;
nix.url = github:nixos/nix/2.26.2;
fakedir = {
url = github:nixie-dev/fakedir;
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
};

# Only required for macOS unit tests
nix-darwin.url = github:nix-darwin/nix-darwin;
};

nixConfig.extra-substituters = "https://nix-wrap.cachix.org";
nixConfig.extra-trusted-public-keys = "nix-wrap.cachix.org-1:FcfSb7e+LmXBZE/MdaFWcs4bW2OQQeBnB/kgWlkZmYI=";

outputs = { self, nix, nixpkgs, flake-utils, fakedir, amber, ... }:
outputs = { self, nix, nixpkgs, nix-darwin, flake-utils, fakedir, amber, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = import nixpkgs { inherit system; };
Expand All @@ -35,13 +40,10 @@
libfakedir = fakedir.packages.${system}.fakedir;
} else {});

checks =
let callTest = f: pkgs.callPackage f { inherit (self.packages.${system}) nixie sources static-bins; };
in {
generation = callTest ./tests/generation.nix;
rootless = callTest ./tests/rootless.nix;
migration = callTest ./tests/migration.nix;
};
checks = import ./tests {
inherit nixpkgs system nix-darwin;
inherit (self.outputs.packages.${system}) nixie sources static-bins;
};

devShells = {
default = pkgs.mkShell {
Expand Down
Loading
Loading