Skip to content

Commit

Permalink
Address PR comments; rework out/samples target
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
  • Loading branch information
egibs committed Sep 12, 2024
1 parent 7054bdd commit 74ebc63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: chainguard-dev/bincapz-samples
path: ${{ github.workspace }}/samples
path: ${{ github.workspace }}/out/samples

- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand All @@ -50,11 +50,11 @@ jobs:
- name: Prepare samples
run: |
cp -a ${{ github.workspace }}/test_data/. ${{ github.workspace }}/samples/
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 }}/samples/linux/clean/${file} -C ${{ github.workspace }}/samples/linux/clean; \
tar -xJvf ${{ github.workspace }}/out/samples/linux/clean/${file} -C ${{ github.workspace }}/out/samples/linux/clean; \
done
tar -xJvf ${{ github.workspace }}/samples/macOS/clean/bincapz.xz -C ${{ github.workspace }}/samples/macOS/clean
tar -xJvf ${{ github.workspace }}/out/samples/macOS/clean/bincapz.xz -C ${{ github.workspace }}/out/samples/macOS/clean
- name: Test
run: |
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ fix: $(FIXERS)
SAMPLES_HASH=bdcb8c2e9bf557a0abe3e2b0144f437d456299b7
out/samples-$(SAMPLES_HASH):
mkdir -p out
git clone git@github.com:chainguard-dev/bincapz-samples.git out/samples-$(SAMPLES_HASH)
pushd out/samples-$(SAMPLES_HASH); git checkout $(SAMPLES_HASH); popd

prepare-samples: out/samples-$(SAMPLES_HASH)
rm -rf samples; cp -a out/samples-$(SAMPLES_HASH) samples/
cp -a test_data/. samples/
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 samples/linux/clean/$$file -C samples/linux/clean; \
tar -xJvf out/samples-$(SAMPLES_HASH).tmp/linux/clean/$$file -C out/samples-$(SAMPLES_HASH).tmp/linux/clean; \
done
tar -xJvf samples/macOS/clean/bincapz.xz -C samples/macOS/clean
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)

prepare-samples: out/samples-$(SAMPLES_HASH)
cp -a test_data/. out/samples-$(SAMPLES_HASH)

.PHONY: test
test: prepare-samples
Expand Down Expand Up @@ -127,7 +127,7 @@ update-third-party:
.PHONY: refresh-sample-testdata out/bincapz
refresh-sample-testdata: clone-samples out/bincapz
cp ./test_data/refresh-testdata.sh samples/
./samples/refresh-testdata.sh ./out/bincapz
./out/samples/refresh-testdata.sh ./out/bincapz

ARCH ?= $(shell uname -m)
CRANE_VERSION=v0.20.2
Expand Down
2 changes: 1 addition & 1 deletion test_data/samples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func TestDiff(t *testing.T) {
MinRisk: tc.minResultScore,
Renderer: simple,
Rules: yrs,
ScanPaths: []string{strings.TrimPrefix(tc.src, "../samples/"), strings.TrimPrefix(tc.dest, "../samples/")},
ScanPaths: []string{strings.TrimPrefix(tc.src, "../out/samples/"), strings.TrimPrefix(tc.dest, "../out/samples/")},
}

logger := clog.New(slog.Default().Handler()).With("src", tc.src)
Expand Down

0 comments on commit 74ebc63

Please sign in to comment.