| # 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. |
| |
| name: Continuous Integration |
| |
| on: |
| pull_request: |
| push: |
| branches: |
| - main |
| |
| jobs: |
| check: |
| name: Check |
| runs-on: ubuntu-20.04 |
| steps: |
| - uses: actions/setup-node@v3 |
| with: |
| node-version: 16.15 |
| - name: Install Go |
| uses: actions/setup-go@v2 |
| with: |
| go-version: 1.19 |
| - name: Check out code into the Go module directory |
| uses: actions/checkout@v2 |
| - name: Check License Header |
| run: make license-check |
| - uses: actions/cache@v3 |
| id: cache-go |
| with: |
| path: | |
| ~/.cache/go-build |
| ~/go/pkg/mod |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| restore-keys: | |
| ${{ runner.os }}-go- |
| - name: Update dependencies |
| if: steps.cache-go.outputs.cache-hit != 'true' |
| run: GOPROXY=https://proxy.golang.org go mod download |
| - name: Generate codes |
| run: make generate |
| - name: Lint |
| run: make lint |
| - name: Check |
| run: make check |
| build: |
| name: Build |
| runs-on: ubuntu-20.04 |
| steps: |
| - uses: actions/setup-node@v3 |
| with: |
| node-version: 16.15 |
| - name: Install Go |
| uses: actions/setup-go@v2 |
| with: |
| go-version: 1.19 |
| - name: Check out code into the Go module directory |
| uses: actions/checkout@v2 |
| - uses: actions/cache@v3 |
| id: cache-go |
| with: |
| path: | |
| ~/.cache/go-build |
| ~/go/pkg/mod |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| restore-keys: | |
| ${{ runner.os }}-go- |
| - name: Update dependencies |
| if: steps.cache-go.outputs.cache-hit != 'true' |
| run: GOPROXY=https://proxy.golang.org go mod download |
| - name: Build |
| run: make build |
| - name: Build release |
| run: make release |
| test: |
| name: Test |
| runs-on: ubuntu-20.04 |
| strategy: |
| matrix: |
| tz: ["UTC", "Asia/Shanghai", "America/Los_Angeles"] |
| steps: |
| - name: Set timezone |
| run: sudo timedatectl set-timezone ${{ matrix.tz }} |
| - uses: actions/setup-node@v3 |
| with: |
| node-version: 16.15 |
| - name: Install Go |
| uses: actions/setup-go@v2 |
| with: |
| go-version: 1.19 |
| - name: Check out code into the Go module directory |
| uses: actions/checkout@v2 |
| - uses: actions/cache@v3 |
| id: cache-go |
| with: |
| path: | |
| ~/.cache/go-build |
| ~/go/pkg/mod |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| restore-keys: | |
| ${{ runner.os }}-go- |
| - name: Update dependencies |
| if: steps.cache-go.outputs.cache-hit != 'true' |
| run: GOPROXY=https://proxy.golang.org go mod download |
| - name: Generate mocks |
| run: make generate |
| - name: Test |
| run: make test-ci |
| - name: Upload coverage to Codecov |
| uses: codecov/codecov-action@v3 |
| result: |
| name: Continuous Integration |
| runs-on: ubuntu-20.04 |
| needs: [check, build, test] |
| steps: |
| - run: echo 'success' |
| |