diff --git a/.github/workflows/go-tests.yaml b/.github/workflows/go-tests.yaml index d534493d..84174e6a 100644 --- a/.github/workflows/go-tests.yaml +++ b/.github/workflows/go-tests.yaml @@ -26,12 +26,6 @@ jobs: - name: Checkout code uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - repository: chainguard-dev/bincapz-samples - path: ${{ github.workspace }}/out/samples - - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: go-version-file: go.mod @@ -50,12 +44,8 @@ jobs: - name: Prepare samples run: | - cp -a ${{ github.workspace }}/test_data/. ${{ github.workspace }}/out/samples/ - for file in caddy.xz chezmoi.xz minio_x86_64.xz mongosh.xz neuvector_agent_aarch64.xz opa.xz ; do \ - tar -xJvf ${{ github.workspace }}/out/samples/linux/clean/${file} -C ${{ github.workspace }}/out/samples/linux/clean; \ - done - tar -xJvf ${{ github.workspace }}/out/samples/macOS/clean/bincapz.xz -C ${{ github.workspace }}/out/samples/macOS/clean + make prepare-samples - name: Test run: | - go test $(go list ./... | grep -v test_data) + make test diff --git a/Makefile b/Makefile index 91de8b9f..338228d0 100644 --- a/Makefile +++ b/Makefile @@ -47,19 +47,18 @@ fix: $(FIXERS) # END: lint-install ../bincapz +SAMPLES_REPO=https://github.com/chainguard-dev/bincapz-samples.git SAMPLES_HASH=bdcb8c2e9bf557a0abe3e2b0144f437d456299b7 +OUT_DIR=out/samples-$(SAMPLES_HASH).tmp out/samples-$(SAMPLES_HASH): mkdir -p out - git clone https://github.com/chainguard-dev/bincapz-samples.git out/samples-$(SAMPLES_HASH).tmp - git -C out/samples-$(SAMPLES_HASH).tmp checkout $(SAMPLES_HASH) - for file in caddy.xz chezmoi.xz minio_x86_64.xz mongosh.xz neuvector_agent_aarch64.xz opa.xz ; do \ - tar -xJvf out/samples-$(SAMPLES_HASH).tmp/linux/clean/$$file -C out/samples-$(SAMPLES_HASH).tmp/linux/clean; \ - done - tar -xJvf out/samples-$(SAMPLES_HASH).tmp/macOS/clean/bincapz.xz -C out/samples-$(SAMPLES_HASH).tmp/macOS/clean - mv out/samples-$(SAMPLES_HASH).tmp out/samples-$(SAMPLES_HASH) + git clone $(REPO) $(OUT_DIR) + git -C $(OUT_DIR) checkout $(SAMPLES_HASH) + find $(OUT_DIR) -name "*.xz" -execdir tar xjvf "{}" \; + mv $(OUT_DIR) $(basename $(OUT_DIR)) prepare-samples: out/samples-$(SAMPLES_HASH) - cp -a test_data/. out/samples-$(SAMPLES_HASH) + cp -a test_data/. $(basename $(OUT_DIR)) .PHONY: test test: prepare-samples