Skip to content

tests: add github action for golang functions #8

tests: add github action for golang functions

tests: add github action for golang functions #8

---
name: golang-function-testing
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
go-example:
runs-on: ubuntu-latest
strategy:
matrix:
tests: [
{ directory: 'cors-go', go-version: '1.19' },
{ directory: 'go-mnq-sqs-publish', go-version: '1.18' },
{ directory: 'go-upload-file-s3-multipart', go-version: '1.20' }
]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go ${{ matrix.tests.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.tests.go-version}}
- name: Run test for ${{ matrix.tests.directory }}
working-directory: functions/${{ matrix.tests.directory }}
run: |
go run test/main.go &
go test ./...
env:
# for go-mnq-sqs-publish example
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
SCW_DEFAULT_REGION: ${{ secrets.SCW_DEFAULT_REGION }}
SCW_DEFAULT_ZONE: ${{ secrets.SCW_DEFAULT_ZONE }}
SQS_ACCESS_KEY: ${{ secrets.SQS_ACCESS_KEY }}
SQS_SECRET_KEY: ${{ secrets.SQS_SECRET_KEY }}
# for go-upload-file-s3-multipart example
S3_ENABLED: true
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
S3_ACCESSKEY: ${{ secrets.SCW_ACCESS_KEY }}
S3_SECRET: ${{ secrets.SCW_SECRET_KEY }}
S3_BUCKET_NAME: ${{secrets.S3_BUCKET_NAME}}
S3_REGION: ${{ secrets.SCW_DEFAULT_REGION }}