Skip to content

Commit

Permalink
fix check for clean worktree
Browse files Browse the repository at this point in the history
  • Loading branch information
aschepis committed Apr 30, 2024
1 parent 8397bdb commit 443ccdc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
26 changes: 2 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,6 @@ jobs:
working-directory: provider
args: -c ../.golangci.yml

test_generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21
cache: false
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
tag: v0.0.46
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: ^3
- name: Lint Provider
run: make test_generate

test:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -147,7 +124,8 @@ jobs:
gradle-version: ${{ env.GRADLEVERSION }}
- name: Build SDK
run: make provider build_${{ matrix.language }}
# TODO: Check worktree clean
- name: Check worktree clean
run: ./scripts/check_for_diffs.sh
strategy:
fail-fast: true
matrix:
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,8 @@ tfgen: install_plugins
(cd provider && VERSION=$(VERSION) go generate cmd/$(PROVIDER)/main.go)

.PHONY: test_generate
test-generate: provider
@echo "--- :golang: go mod tidy"
(cd provider && go mod tidy)
@echo "--- :git: Testing generate code is up to date"
@[ -z "$$(git status --porcelain)" ] || ((set -x; git status --porcelain; git diff); echo -e "^^^ +++\nCheck git status + diff above, there are changed or untracked files"; exit 1)
test_generate:
./scripts/check_for_diffs.sh

bin/pulumi-java-gen:
pulumictl download-binary -n pulumi-language-java -v $(JAVA_GEN_VERSION) -r pulumi/pulumi-java
Expand Down
17 changes: 17 additions & 0 deletions scripts/check_for_diffs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

echo "--- :golang: go mod tidy"
(cd provider && go mod tidy)

echo "--- :git: Testing generate code is up to date"
# Enable debugging to see commands executed, if needed
# set -x

# Check if there are any changes or untracked files
if [ -n "$(git status --porcelain)" ]; then
echo "^^^ +++"
git status --porcelain
git diff
echo "Check git status + diff above, there are changed or untracked files"
exit 1
fi

0 comments on commit 443ccdc

Please sign in to comment.