Add cmd/inspect: eventbus + LiveView demo #107
This file contains hidden or 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
| name: "Commit" | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - '*' | |
| workflow_call: | |
| permissions: | |
| checks: write | |
| packages: write | |
| jobs: | |
| compile-binary: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Compile Go binary" | |
| run: go build cmd/server/main.go | |
| build-image: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - compile-binary | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Log in to GitHub Docker registry" | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
| - name: "Build Docker image" | |
| run: docker build -f ci/Dockerfile -t ghcr.io/${{ github.repository_owner }}/golang-build:latest . | |
| - name: "Push Docker image" | |
| run: docker push ghcr.io/${{ github.repository_owner }}/golang-build:latest | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Install gotestsum" | |
| run: | | |
| go install gotest.tools/gotestsum@latest | |
| - name: "Run Go tests" | |
| run: | | |
| gotestsum --junitfile junit-report.xml --format standard-verbose ./... | |
| - name: "Check if test reports were created" | |
| id: junit-reports-exist | |
| uses: andstor/file-existence-action@v3 | |
| with: | |
| files: "junit-report.xml" | |
| - name: "Publish Test Report" | |
| uses: mikepenz/action-junit-report@v6 | |
| if: steps.junit-reports-exist.outputs.files_exists == 'true' | |
| with: | |
| report_paths: 'junit-report.xml' | |
| complexity: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Install gocyclo" | |
| run: | | |
| go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | |
| - name: "Run gocyclo" | |
| run: | | |
| gocyclo -over 10 -ignore '_test\.go$' . | |
| static-analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Install golangci-lint v2" | |
| run: | | |
| go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest | |
| - name: "Run golangci-lint" | |
| run: | | |
| golangci-lint run | |
| check-licenses: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Install go-licenses" | |
| run: | | |
| go install github.com/google/go-licenses@latest | |
| - name: "Run go-licenses" | |
| run: | | |
| go-licenses report ./... | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Set up Go" | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: "Install gosec" | |
| run: | | |
| go install github.com/securego/gosec/v2/cmd/gosec@latest | |
| - name: "Run gosec" | |
| run: | | |
| # Excluded rules: | |
| # G104 — best-effort cleanup of os.Remove etc. is documented and intentional | |
| # G304 — vfs/fsutil/cacheutil take filesystem paths as input by design | |
| # G602 — false positive on byte conversion of UintN(256) | |
| # G703 — same path-as-input rationale as G304 | |
| # G704 — httpx is an HTTP client library; URL is caller input by design | |
| gosec -exclude=G104,G304,G602,G703,G704 -fmt=junit-xml -out=gosec-report.xml -stdout ./... | |
| - name: "Check if security report was created" | |
| id: gosec-report-exists | |
| uses: andstor/file-existence-action@v3 | |
| with: | |
| files: "gosec-report.xml" | |
| - name: "Publish Security Report" | |
| uses: mikepenz/action-junit-report@v6 | |
| if: steps.gosec-report-exists.outputs.files_exists == 'true' | |
| with: | |
| report_paths: 'gosec-report.xml' | |
| codeql-analysis: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| security-events: write | |
| steps: | |
| - name: "Git Checkout" | |
| uses: actions/checkout@v6 | |
| - name: "Initialize CodeQL" | |
| uses: github/codeql-action/init@v4 | |
| with: | |
| languages: 'go' | |
| - name: "Perform CodeQL Analysis" | |
| uses: github/codeql-action/analyze@v4 |