Skip to content

feat: Go Component & Provider Templates #2

feat: Go Component & Provider Templates

feat: Go Component & Provider Templates #2

Workflow file for this run

name: Templates
on:
push:
branches: ["main"]
paths:
- ".github/workflows/templates-go.yaml"
- "templates/**"
pull_request:
branches: ["main"]
paths:
- ".github/workflows/templates-go.yaml"
- "templates/**"
env:
TINYGO_VERSION: "0.33.0"
GOLANGCI_VERSION: "v1.61"
WASH_VERSION: "0.37.0"
WASM_TOOLS_VERSION: "1.220.0"
permissions:
contents: read
jobs:
components:
# Context: https://github.com/golangci/golangci-lint-action/blob/v6.1.1/README.md#annotations
permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow write access to checks to allow the action to annotate code in the PR.
checks: write
strategy:
matrix:
template-name:
- http-hello-world
tinygo-version:
- "0.33.0"
- "0.34.0"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: taiki-e/install-action@a2ff97ae7a403b9e691f3d5d5e214415068a681b # v2.46.7
with:
tool: ${{ format('wash-cli@{0},wasm-tools@{1}', env.WASH_VERSION, env.WASM_TOOLS_VERSION) }}
- name: Create project from template
run: |
cd $RUNNER_TEMP
rm -rf sample-component || true
wash new component --silent --path $GITHUB_WORKSPACE/templates/components/${{ matrix.template-name }}
cd sample-component
wash build
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "$RUNNER_TEMP/sample-component/go.mod"
- uses: acifani/setup-tinygo@b2ba42b249c7d3efdfe94166ec0f48b3191404f7 # v2.0.0
with:
tinygo-version: ${{ matrix.tinygo-version }}
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: ${{ env.GOLANGCI_VERSION }}
working-directory: "$RUNNER_TEMP/sample-component"
- name: Test
run: go test -v ./...
working-directory: "$RUNNER_TEMP/sample-component"