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: steps:
- uses: actions/checkout@v4 - 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 - uses: cachix/install-nix-action@v27
run: go mod download with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Nix flake
run: nix flake check
- name: Run tests - name: Run tests
run: go test -v ./... run: nix develop --command bash -c 'go test ./...'

View File

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