Skip to content

Commit

Permalink
ci: Add compile and code gen checks
Browse files Browse the repository at this point in the history
  • Loading branch information
romshark committed Jun 10, 2024
1 parent 5e54c20 commit 716ef34
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
check-latest: true
- name: Checkout repository
uses: actions/checkout@v3

# Test
- name: Test
run: go test -v -race ./...
- name: Calculate coverage
Expand All @@ -25,3 +27,21 @@ jobs:
- name: Run go vet
continue-on-error: true
run: go vet ./...

# Make sure templ generate was executed before commit
- name: Generate templates
run: go run github.com/a-h/templ/cmd/templ generate
- name: Check file changes after templ generate
run: |
git diff --exit-code
id: diff_files_after_templ_generate
continue-on-error: true
- name: Fail if changes are detected
if: steps.diff_files_after_templ_generate.outcome == 'failure'
run: |
echo "Detected uncommitted changes after running templ generate." \
"Please regenerate .templ templates and commit changes." && exit 1
# Try compile
- name: Compile
run: go build -o /dev/null .

0 comments on commit 716ef34

Please sign in to comment.