feat(ci-cd): Use nix build to build the program

This commit is contained in:
Myzel394 2024-08-19 23:05:07 +02:00
parent 70b05e19fe
commit 91f0b0b52b
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
2 changed files with 35 additions and 30 deletions

View File

@ -11,16 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
# You can test your matrix by printing the current Go version
- name: Display Go version
run: go version
- name: Get dependencies
run: go mod download
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Nix flake
run: nix flake check
- name: Run tests
run: go test -v ./...
run: nix develop --command bash -c 'go test ./...'

View File

@ -24,18 +24,25 @@
gomod2nix.overlays.default
];
};
inputs = [
pkgs.go_1_22
pkgs.wireguard-tools
];
in {
defaultPackage = pkgs.buildGoModule {
packages = {
default = pkgs.buildGoModule {
nativeBuildInputs = inputs;
pname = "github.com/Myzel394/config-lsp";
version = "v0.0.1";
src = ./.;
vendorHash = "sha256-KhyqogTyb3jNrGP+0Zmn/nfx+WxzjgcrFOp2vivFgT0=";
checkPhase = ''
go test -v $(pwd)/...
'';
};
devShell = pkgs.mkShell {
buildInputs = [
pkgs.go_1_22
pkgs.wireguard-tools
];
};
devShells.default = pkgs.mkShell {
buildInputs = inputs;
};
}
);