ci: add linter, update pr template, variety of cleanups (#47) #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
pull_request: | |
types: [opened, synchronize, edited, reopened] | |
push: | |
branches: | |
- main | |
env: | |
GO_VERSION: 1.21.0 | |
jobs: | |
test-unit-coverage: | |
name: Unit & Coverage | |
runs-on: namespace-profile-linux-4vcpu-8gb-cached | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Setup Docker build to use Namespace workspace builder | |
- name: Configure Namespace powered Buildx | |
uses: namespacelabs/nscloud-setup-buildx-action@v0 | |
- name: Setup Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
## skip cache, use Namespace volume cache | |
cache: false | |
- name: Init Dummy Git config for testing | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-action" | |
- name: Setup Namespace cache | |
uses: namespacelabs/nscloud-cache-action@v1 | |
with: | |
cache: go | |
- name: Run unit tests with coverage | |
shell: 'script -q -e -c "bash {0}"' | |
run: make test-coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
directory: "./" |