Skip to content

Commit

Permalink
[ci] use s1-goval-nixos
Browse files Browse the repository at this point in the history
  • Loading branch information
vlinkz committed Dec 7, 2024
1 parent 99dfba8 commit 38e31e0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 31 deletions.
14 changes: 5 additions & 9 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: v1.0
name: UPM
agent:
machine:
type: s1-goval
type: s1-goval-nixos

global_job_config:
env_vars:
Expand All @@ -13,8 +13,7 @@ global_job_config:
commands:
- checkout
- git switch --detach
- export PATH="/tmp:$PATH"
- source ./.semaphore/install_nix.sh
- eval "$(nix print-dev-env)"

blocks:
- name: test
Expand All @@ -23,7 +22,8 @@ blocks:
jobs:
- name: test-suite
commands:
- nix develop -c nix shell -c make test-suite
- export PATH="$(nix build . --no-link --print-out-paths)/bin:$PATH"
- make test-suite
epilogue:
commands:
- test-results publish junit.xml
Expand All @@ -35,11 +35,7 @@ blocks:
- name: golang lint
commands:
- make generated
- cache restore golangci-lint
- >-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
| sh -s -- -b /tmp v1.55.2
- /tmp/golangci-lint run
- golangci-lint run

after_pipeline:
task:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ test-suite:
go run gotest.tools/gotestsum --junitfile ./junit.xml ./test-suite
else
test-suite:
nix develop -c nix shell -c go test -run $(GO_TEST_RUN_OPTS) ./test-suite
go test -run $(GO_TEST_RUN_OPTS) ./test-suite

# I don't have a great name for these. The cases are as follows:
# make test-python3 # This runs inside nix develop and gates test suite
Expand All @@ -112,7 +112,7 @@ test-suite:
# # two modes. It isn't very useful when run directly,
# # since it doesn't know where upm or the PYPI_MAP_DB are.
test-%:
nix develop -c nix shell -c make wrapped-$@
make wrapped-$@

unwrapped-test-%:
label="$@"; \
Expand Down
3 changes: 2 additions & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ in rec {
default = upm;
devShell = pkgs.callPackage ./devshell {nix-editor = nix-editor-pkg;};
fmt = pkgs.callPackage ./fmt {};
upm = pkgs.callPackage ./upm {inherit rev; inherit buildGoCache;};
upm = pkgs.callPackage ./upm {inherit rev; inherit goCache;};
goCache = pkgs.callPackage ./goCache {inherit buildGoCache;};
}
16 changes: 16 additions & 0 deletions nix/goCache/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
buildGoCache,
runCommand,
}:
buildGoCache {
# keep this up-to-date in CI with:
# $ nix run 'github:numtide/build-go-cache#get-external-imports' -- ./. imported-packages
importPackagesFile = ./imported-packages;
# FIXME: Somehow we get cache invalidation everytime if we don't do this, also it uses a source filter
src = runCommand "go-mod" {} ''
install -D ${../../go.mod} $out/go.mod
install -D ${../../go.sum} $out/go.sum
'';
vendorHash = "sha256-vHWl1t/tZ1siHJpxazIzkD3FSYokPm7KZVnM+X02O9Q=";
proxyVendor = true;
}
File renamed without changes.
21 changes: 2 additions & 19 deletions nix/upm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,8 @@
buildGoModule,
rev,
makeWrapper,
buildGoCache,
runCommand,
goCache,
}:
let
vendorHash = "sha256-vHWl1t/tZ1siHJpxazIzkD3FSYokPm7KZVnM+X02O9Q=";

goCache = buildGoCache {
# keep this up-to-date in CI with:
# $ nix run 'github:numtide/build-go-cache#get-external-imports' -- ./. imported-packages
importPackagesFile = ./imported-packages;
# FIXME: Somehow we get cache invalidation everytime if we don't do this, also it uses a source filter
src = runCommand "go-mod" {} ''
install -D ${../../go.mod} $out/go.mod
install -D ${../../go.sum} $out/go.sum
'';
inherit vendorHash;
proxyVendor = true;
};
in
buildGoModule rec {
pname = "upm";
version = rev;
Expand Down Expand Up @@ -60,7 +43,7 @@ buildGoModule rec {
--set PYPI_MAP_DB "$out/pypi_map.sqlite"
'';

inherit vendorHash;
inherit (goCache) vendorHash;
proxyVendor = true; # we only support proxyVendor with buildGoCache just now

doCheck = false;
Expand Down

0 comments on commit 38e31e0

Please sign in to comment.