|
| 1 | +name: wasmbus |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + paths: |
| 7 | + - ".github/workflows/wasmbus-go.yaml" |
| 8 | + - "wasmbus/**" |
| 9 | + pull_request: |
| 10 | + branches: ["main"] |
| 11 | + paths: |
| 12 | + - ".github/workflows/wasmbus-go.yaml" |
| 13 | + - "wasmbus/**" |
| 14 | + |
| 15 | +env: |
| 16 | + GOLANGCI_VERSION: "v1.61" |
| 17 | + WASH_VERSION: "0.37.0" |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + lint: |
| 24 | + # Context: https://github.com/golangci/golangci-lint-action/blob/v6.1.1/README.md#annotations |
| 25 | + permissions: |
| 26 | + # Required: allow read access to the content for analysis. |
| 27 | + contents: read |
| 28 | + # Optional: allow write access to checks to allow the action to annotate code in the PR. |
| 29 | + checks: write |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 33 | + - uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 |
| 34 | + with: |
| 35 | + version: ${{ env.GOLANGCI_VERSION }} |
| 36 | + working-directory: wasmbus |
| 37 | + |
| 38 | + - name: Go generate |
| 39 | + run: | |
| 40 | + go generate ./... |
| 41 | + if ! test -z "$(git status --porcelain)"; then |
| 42 | + echo "Go generate modified files. Please run go generate and commit the changes." |
| 43 | + git status |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + test: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 51 | + - uses: taiki-e/install-action@ed8c79bccf0b1cb1544a358f81684d3acaa5133f # v2.46.11 |
| 52 | + with: |
| 53 | + tool: ${{ format('wash-cli@{0}', env.WASH_VERSION) }} |
| 54 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 55 | + with: |
| 56 | + go-version-file: "wasmbus/go.mod" |
| 57 | + |
| 58 | + - name: Build |
| 59 | + working-directory: wasmbus |
| 60 | + run: go build -v ./... |
| 61 | + |
| 62 | + # NOTE(lxf): Tests are split into multiple steps to avoid wash race conditions. |
| 63 | + |
| 64 | + - name: wasmbus |
| 65 | + working-directory: wasmbus |
| 66 | + run: go test -v -wash-output |
| 67 | + |
| 68 | + - name: wasmbus/control |
| 69 | + working-directory: wasmbus/control |
| 70 | + run: go test -v -wash-output |
| 71 | + |
| 72 | + - name: wasmbus/wadm |
| 73 | + working-directory: wasmbus/wadm |
| 74 | + run: go test -v -wash-output |
| 75 | + |
| 76 | + - name: wasmbus/events |
| 77 | + working-directory: wasmbus/events |
| 78 | + run: go test -v -wash-output |
0 commit comments