Skip to content

Commit

Permalink
Fix test-readme (#50)
Browse files Browse the repository at this point in the history
* Fix test-readme

Signed-off-by: Friedrich Gonzalez <[email protected]>

* Add error

Signed-off-by: Friedrich Gonzalez <[email protected]>

* :ry again

Signed-off-by: Friedrich Gonzalez <[email protected]>

* Fix test

Signed-off-by: Friedrich Gonzalez <[email protected]>

* Remove unneeded

Signed-off-by: Friedrich Gonzalez <[email protected]>

* Really show content

Signed-off-by: Friedrich Gonzalez <[email protected]>

---------

Signed-off-by: Friedrich Gonzalez <[email protected]>
  • Loading branch information
friedrichg authored Jun 8, 2024
1 parent 47240d3 commit 1fcee6a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
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

0 comments on commit 1fcee6a

Please sign in to comment.