Skip to content

feat: Go Component & Provider Templates #10

feat: Go Component & Provider Templates

feat: Go Component & Provider Templates #10

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"
WRPC_VERSION: "0.11.1"
permissions:
contents: read
jobs:
providers:
# 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:
- keyvalue-inmemory
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},wrpc@{2}', env.WASH_VERSION, env.WASM_TOOLS_VERSION, env.WRPC_VERSION) }}
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "templates/providers/${{ matrix.template-name }}/go.mod"
- name: wash new
run: |
mkdir .tmp || true
cd .tmp
rm -rf sample-provider || true
wash new provider --silent --path $GITHUB_WORKSPACE/templates/providers/${{ matrix.template-name }} sample-provider
- name: wash build
run: wash build
working-directory: ".tmp/sample-provider"
- name: Go Lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: ${{ env.GOLANGCI_VERSION }}
working-directory: ".tmp/sample-provider"
- name: Go Test
run: go test -v ./...
working-directory: ".tmp/sample-provider"
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) }}
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: "templates/components/${{ matrix.template-name }}/go.mod"
- uses: acifani/setup-tinygo@b2ba42b249c7d3efdfe94166ec0f48b3191404f7 # v2.0.0
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: wash new
run: |
mkdir .tmp || true
cd .tmp
rm -rf sample-component || true
wash new component --silent --path $GITHUB_WORKSPACE/templates/components/${{ matrix.template-name }} sample-component
- name: wash build
run: wash build
working-directory: ".tmp/sample-component"
- name: Go Lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: ${{ env.GOLANGCI_VERSION }}
working-directory: ".tmp/sample-component"
- name: Go Test
run: go test -v ./...
working-directory: ".tmp/sample-component"