From 2013484be27de08dae695b41ed6917354b99ccdb Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 9 Oct 2025 16:33:06 -0400 Subject: [PATCH 1/6] CI tests for keystore --- .github/workflows/keystore.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/keystore.yml diff --git a/.github/workflows/keystore.yml b/.github/workflows/keystore.yml new file mode 100644 index 000000000..b690017fe --- /dev/null +++ b/.github/workflows/keystore.yml @@ -0,0 +1,27 @@ +name: Keystore Checks + +on: + push: + paths: + - "keystore/**" + +jobs: + run-tests: + defaults: + run: + working-directory: keystore + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version-file: "go.mod" + + - name: Build + run: go build -v ./... + + - name: Unit Tests + run: go test ./... -coverpkg=./... -coverprofile=coverage.txt From 5a5eac96cd720bfd87e03cbd7167b1885409d4b6 Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 9 Oct 2025 16:35:28 -0400 Subject: [PATCH 2/6] Race and mod tidy check --- .github/workflows/keystore.yml | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.github/workflows/keystore.yml b/.github/workflows/keystore.yml index b690017fe..f06eaa3fa 100644 --- a/.github/workflows/keystore.yml +++ b/.github/workflows/keystore.yml @@ -25,3 +25,62 @@ jobs: - name: Unit Tests run: go test ./... -coverpkg=./... -coverprofile=coverage.txt + build-race-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: ./.github/actions/setup-go + with: + go-version-file: "go.mod" + + - name: Build + run: go build -v ./... + + - name: Race Tests + run: GORACE="log_path=$PWD/race" go test -race ./... + + - name: Print Races + if: failure() + id: print-races + run: | + find race.* | xargs cat > race.txt + if [[ -s race.txt ]]; then + cat race.txt + fi + + - name: Upload Go test results + if: always() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: go-race-results + path: | + ./race.* + check-tidy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: ./.github/actions/setup-go + with: + go-version-file: "go.mod" + only-modules: "true" + + - name: Ensure "make gomodtidy" has been run + run: | + make gomodtidy + git add --all + git diff --minimal --cached --exit-code + + - name: Ensure "make generate" has been run + run: | + make rm-mocked + make rm-builders + make generate + git add --all + git diff --stat --cached --exit-code + From 27181c6d91f3db963f695746b494e2edabcf5448 Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 9 Oct 2025 16:37:13 -0400 Subject: [PATCH 3/6] Specify perms --- .github/workflows/keystore.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/keystore.yml b/.github/workflows/keystore.yml index f06eaa3fa..34e7aa7a0 100644 --- a/.github/workflows/keystore.yml +++ b/.github/workflows/keystore.yml @@ -1,4 +1,6 @@ name: Keystore Checks +permissions: + contents: read on: push: @@ -25,6 +27,7 @@ jobs: - name: Unit Tests run: go test ./... -coverpkg=./... -coverprofile=coverage.txt + build-race-tests: runs-on: ubuntu-latest steps: From 139caf6824d7f34709e5d816aad9d1ac371345cc Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 9 Oct 2025 17:00:48 -0400 Subject: [PATCH 4/6] test --- keystore/encryptor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystore/encryptor.go b/keystore/encryptor.go index 590f439bf..0908f5957 100644 --- a/keystore/encryptor.go +++ b/keystore/encryptor.go @@ -54,7 +54,7 @@ func (UnimplementedEncryptor) Decrypt(ctx context.Context, req DecryptRequest) ( } func (UnimplementedEncryptor) DeriveSharedSecret(ctx context.Context, req DeriveSharedSecretRequest) (DeriveSharedSecretResponse, error) { - return DeriveSharedSecretResponse{}, fmt.Errorf("Encryptor.DeriveSharedSecret: %w", ErrUnimplemented) + return DeriveSharedSecretResponse{}, fmt.Errorf("Encryptor.DeriveSharedSecret : %w", ErrUnimplemented) } // TODO: Encryptor implementation. From 92e3622578da236c5dc5255373988b68f9faa211 Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 9 Oct 2025 17:06:46 -0400 Subject: [PATCH 5/6] Undo test change --- keystore/encryptor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystore/encryptor.go b/keystore/encryptor.go index 0908f5957..590f439bf 100644 --- a/keystore/encryptor.go +++ b/keystore/encryptor.go @@ -54,7 +54,7 @@ func (UnimplementedEncryptor) Decrypt(ctx context.Context, req DecryptRequest) ( } func (UnimplementedEncryptor) DeriveSharedSecret(ctx context.Context, req DeriveSharedSecretRequest) (DeriveSharedSecretResponse, error) { - return DeriveSharedSecretResponse{}, fmt.Errorf("Encryptor.DeriveSharedSecret : %w", ErrUnimplemented) + return DeriveSharedSecretResponse{}, fmt.Errorf("Encryptor.DeriveSharedSecret: %w", ErrUnimplemented) } // TODO: Encryptor implementation. From e01298e0dc8c79dd55bf5417d5fa988bd113f0ef Mon Sep 17 00:00:00 2001 From: connorwstein Date: Fri, 10 Oct 2025 11:18:16 -0400 Subject: [PATCH 6/6] PR comments --- .github/workflows/keystore.yml | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/.github/workflows/keystore.yml b/.github/workflows/keystore.yml index 34e7aa7a0..081b178bc 100644 --- a/.github/workflows/keystore.yml +++ b/.github/workflows/keystore.yml @@ -18,9 +18,10 @@ jobs: uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + uses: ./.github/actions/setup-go with: go-version-file: "go.mod" + restore-build-cache-only: "false" - name: Build run: go build -v ./... @@ -60,30 +61,4 @@ jobs: with: name: go-race-results path: | - ./race.* - check-tidy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Go - uses: ./.github/actions/setup-go - with: - go-version-file: "go.mod" - only-modules: "true" - - - name: Ensure "make gomodtidy" has been run - run: | - make gomodtidy - git add --all - git diff --minimal --cached --exit-code - - - name: Ensure "make generate" has been run - run: | - make rm-mocked - make rm-builders - make generate - git add --all - git diff --stat --cached --exit-code - + ./race.* \ No newline at end of file