Skip to content

Commit

Permalink
Use Make targets in CI; simplify + clean up targets
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 74ebc63 commit 04a6d33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/go-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $(SAMPLES_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
Expand Down

0 comments on commit 04a6d33

Please sign in to comment.