CI pipeline for PR - (#177) ci: Add tests execution and TF provider support #438
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build and test a golang project | |
name: PR CI | |
run-name: "CI pipeline for PR - (#${{ github.event.number }}) ${{ github.event.pull_request.title }}" | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
jobs: | |
golangci: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60 | |
ci: | |
name: Continuous integration | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Download Go dependencies | |
run: go get ./... && go mod tidy | |
- name: Check if all dependencies were commited | |
shell: bash | |
run: | | |
if [ "$(git status --porcelain)" ]; then | |
git status | |
exit 1 | |
else | |
exit 0 | |
fi | |
- name: Build codegen | |
run: go build -v ./... | |
- name: Test codegen | |
run: go test -v ./... | |
generate: | |
needs: ci | |
name: Generate code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Download Go dependencies | |
run: go get ./... && go mod tidy | |
- name: Test codegen | |
run: go test -v ./... | |
- name: Build codegen | |
run: go build -v ./... | |
- name: Execute codegen for all targets | |
run: go run cmd/codegen/main.go | |
- name: Test generated code | |
run: | | |
for dir in $(ls ../generated); do | |
echo "Run tests for ${dir}" | |
cd ../generated/${dir} | |
go test -v ./... | |
cd - | |
done | |
- name: Workaround actions/upload-artifact#176 | |
run: | | |
echo "artifacts_path=$(realpath ../generated/pango)" >> $GITHUB_ENV | |
- name: Upload generated files for pango SDK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-pango | |
path: | | |
${{ env.artifacts_path }} | |
retention-days: 3 | |
if-no-files-found: error |