Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test-readme #50

Merged
merged 7 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0
Expand All @@ -36,10 +36,14 @@ jobs:
runs-on: ubuntu-latest
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0

- name: "Test readme"
run: make test-readme
- name: "Test readme s3"
run: make test-readme/s3
- name: "Test readme azure"
run: make test-readme/azure
- name: "Test readme gcs"
run: make test-readme/gcs
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: lint build-image publish-build-image test-readme
.PHONY: lint build-image publish-build-image test-readme clean

JSONNET_FMT := jsonnetfmt

Expand Down Expand Up @@ -47,18 +47,17 @@ build-mixin:
test-readme: test-readme/azure test-readme/gcs test-readme/s3

test-readme/%:
rm -rf $@ && \
mkdir -p $@ && cd $@ && \
tk init --k8s=1.24 && \
jb install github.com/cortexproject/cortex-jsonnet/cortex@main && \
rm -fr ./vendor/cortex && \
cp -r ../../cortex ./vendor/ && \
cp vendor/cortex/$(notdir $@)/main.jsonnet.example environments/default/main.jsonnet && \
PAGER=cat tk show environments/default
@./scripts/test-readme.sh $@

clean-white-noise:
@$(FIND) . -type f -regextype posix-extended -regex '.*(md|libsonnet)' -print | \
SED_BIN="$(SED)" xargs ./scripts/cleanup-white-noise.sh

check-white-noise: clean-white-noise
@git diff --exit-code --quiet || (echo "Please remove trailing whitespaces running 'make clean-white-noise'" && false)

clean:
rm -rf cortex-mixin/out
rm -rf cortex-mixin/vendor
rm -f cortex-mixin/cortex-mixin.zip
rm -rf test-readme
11 changes: 11 additions & 0 deletions scripts/test-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -xe
rm -rf $1
mkdir -p $1
cd $1
tk init --k8s=1.26
jb install github.com/cortexproject/cortex-jsonnet/cortex@main
rm -fr ./vendor/cortex
cp -r ../../cortex ./vendor/
cp vendor/cortex/$(basename $1)/main.jsonnet.example environments/default/main.jsonnet
PAGER=cat tk show --dangerous-allow-redirect environments/default