| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # To learn more about GitHub Actions in Apache Beam check the CI.md |
| |
| name: Tour of Beam Go unittests |
| |
| on: |
| push: |
| branches: ['master', 'release-*'] |
| tags: 'v*' |
| paths: ['learning/tour-of-beam/backend/**'] |
| pull_request: |
| branches: ['master', 'release-*'] |
| tags: 'v*' |
| paths: ['learning/tour-of-beam/backend/**'] |
| |
| # This allows a subsequently queued workflow run to interrupt previous runs |
| concurrency: |
| group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' |
| cancel-in-progress: true |
| |
| jobs: |
| checks: |
| runs-on: ubuntu-latest |
| defaults: |
| run: |
| working-directory: ./learning/tour-of-beam/backend |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-go@v3 |
| with: |
| # pin to the biggest Go version supported by Cloud Functions runtime |
| go-version: '1.16' |
| - name: Run fmt |
| run: | |
| go fmt ./... |
| git diff-index --quiet HEAD || (echo "Run go fmt before checking in changes" && exit 1) |
| |
| - name: Run vet |
| run: go vet ./... |
| |
| - name: Run test |
| run: go test -v ./... |
| |
| - name: golangci-lint |
| uses: golangci/golangci-lint-action@v3 |
| with: |
| version: v1.49.0 |
| working-directory: learning/tour-of-beam/backend |
| |