8000 add e2e tests by figsoda · Pull Request #712 · nix-community/nix-init · GitHub
[go: up one dir, main page]

Skip to content
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
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*.toml]
indent_size = 2
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on:
push:
branches:
- main
pull_request:

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Set up cachix
uses: cachix/cachix-action@v16
with:
name: nix-community

- name: Cargo test
run: nix develop -c cargo test e2e
111 changes: 111 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ clap_mangen = "0.2.31"
heck = "0.5.0"
insta = "1.46.3"
tempfile = "3.24.0"
trycmd = "0.15.11"

[features]
default = ["vendored"]
Expand Down
5 changes: 5 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ rustPlatform.buildRustPackage rec {
# lang::rust::tests needs additional cargo dependencies
doCheck = false;

# e2e tests require internet access
checkFlags = [
"--skip=e2e"
];

postPatch = ''
mkdir -p data
ln -s ${get-nix-license} data/get_nix_license.rs
Expand Down
26 changes: 26 additions & 0 deletions tests/cmd/drv-no-cc.out/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "zi";
version = "1.0.3";

src = fetchFromGitHub {
owner = "z-shell";
repo = "zi";
tag = "v${finalAttrs.version}";
hash = "sha256-nuw/riQaAdk0fYUpm3z978YGPDJnzc66DnOj774tPu0=";
};

meta = {
description = "[..]";
homepage = "https://github.com/z-shell/zi";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ alice ];
mainProgram = "zi";
platforms = lib.platforms.all;
};
})
6 changes: 6 additions & 0 deletions tests/cmd/drv-no-cc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
args = [
"--headless",
"--url=https://github.com/z-shell/zi",
"--rev=v1.0.3",
"--builder=stdenvNoCC.mkDerivation",
]
69 changes: 69 additions & 0 deletions tests/cmd/drv-rust.out/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
lib,
stdenv,
fetchFromGitHub,
cargo,
meson,
ninja,
pkg-config,
rustPlatform,
rustc,
wrapGAppsHook4,
cairo,
dbus,
gdk-pixbuf,
glib,
gtk4,
libevdev,
libpulseaudio,
pango,
udev,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "sway-osd";
version = "0.3.0";

src = fetchFromGitHub {
owner = "ErikReider";
repo = "SwayOSD";
tag = "v${finalAttrs.version}";
hash = "sha256-DRJ4D+QcgkVZmlfbj2HEIUHnYldzIuSDcpsOAOuoaL0=";
};

cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) pname version src;
hash = "sha256-t0IZvO7Wbx6A7v/sRZOSOLj0O/1m7vOBjZSd99TAutI=";
};

nativeBuildInputs = [
cargo
meson
ninja
pkg-config
rustPlatform.cargoSetupHook
rustc
wrapGAppsHook4
];

buildInputs = [
cairo
dbus
gdk-pixbuf
glib
gtk4
libevdev
libpulseaudio
pango
udev
];

meta = {
description = "[..]";
homepage = "https://github.com/ErikReider/SwayOSD";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ alice ];
mainProgram = "sway-osd";
platforms = lib.platforms.all;
};
})
5 changes: 5 additions & 0 deletions tests/cmd/drv-rust.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
args = [
"--headless",
"--url=https://github.com/ErikReider/SwayOSD",
"--rev=v0.3.0",
]
33 changes: 33 additions & 0 deletions tests/cmd/drv.out/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
lib,
stdenv,
fetchFromGitHub,
meson,
ninja,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "bubblewrap";
version = "0.11.0";

src = fetchFromGitHub {
owner = "containers";
repo = "bubblewrap";
tag = "v${finalAttrs.version}";
hash = "sha256-8IDMLQPeO576N1lizVudXUmTV6hNOiowjzRpEWBsZ+U=";
};

nativeBuildInputs = [
meson
ninja
];

meta = {
description = "[..]";
homepage = "https://github.com/containers/bubblewrap";
license = lib.licenses.lgpl2Only;
maintainers = with lib.maintainers; [ alice ];
mainProgram = "bubblewrap";
platforms = lib.platforms.all;
};
})
5 changes: 5 additions & 0 deletions tests/cmd/drv.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
args = [
"--headless",
"--url=https://github.com/containers/bubblewrap",
4859 "--rev=v0.11.0",
]
Loading
0