-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add linter, update pr template, variety of cleanups (#47)
- Loading branch information
Showing
43 changed files
with
1,151 additions
and
615 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,39 @@ | ||
Closes: #XXX | ||
Closes: WORLD-XXX | ||
|
||
## What is the purpose of the change | ||
|
||
> Add a description of the overall background and high-level changes that this PR introduces | ||
**_Example (remove this)_** | ||
<!--- | ||
Add a prefix to indicate what kind of release this pull request corresponds to: | ||
feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert | ||
---> | ||
|
||
- _The metadata is stored in the blob store on job creation time as a persistent artifact_ | ||
- _Deployments RPC transmits only the blob storage reference_ | ||
- _Daemons retrieve the RPC data from the blob cache_ | ||
## Overview | ||
|
||
> Description of the overall background and high-level changes that this PR introduces | ||
<!--- | ||
Example: This pull request improves documentation of area A by adding ... | ||
---> | ||
|
||
## Brief Changelog | ||
|
||
<!--- | ||
Example: | ||
- The metadata is stored in the blob store on job creation time as a persistent artifact | ||
- Deployments RPC transmits only the blob storage reference | ||
- Daemons retrieve the RPC data from the blob cache | ||
---> | ||
|
||
## Testing and Verifying | ||
|
||
> Please pick one of the following options | ||
This change is a trivial rework/code cleanup without any test coverage. | ||
|
||
**(or)** | ||
|
||
This change is already covered by existing tests, such as _(please describe tests)_. | ||
|
||
**(or)** | ||
|
||
This change added tests and can be verified as follows: | ||
|
||
<!--- | ||
Pick one of the following options: | ||
- This change is a trivial rework/code cleanup without any test coverage. | ||
- This change is already covered by existing tests, such as <describe test>. | ||
- This change added tests and can be verified as follows: | ||
- Added unit test that validates ... | ||
- Added integration tests for end-to-end deployment with ... | ||
- Extended integration test for ... | ||
- Manually verified the change by ... | ||
---> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ on: | |
type: boolean | ||
|
||
jobs: | ||
go-build: | ||
name: Run Go Build | ||
build-go: | ||
name: Go | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
|
@@ -51,7 +51,7 @@ jobs: | |
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-X main.AppVersion=$bin_version -X main.SentryDsn=$sentry_dsn -X main.PosthogApiKey=$posthog_api_key" -o $output_name ./cmd/world | ||
echo "output_name=$output_name" >> $GITHUB_OUTPUT | ||
- name: Compress Build Binary | ||
- name: Compress build binary | ||
uses: a7ul/[email protected] | ||
id: compress | ||
with: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint-go: | ||
name: Go | ||
runs-on: namespace-profile-linux-4vcpu-8gb-cached | ||
env: | ||
GO_VERSION: 1.22.1 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
## skip cache, use Namespace volume cache | ||
cache: false | ||
- name: Setup Namespace cache | ||
uses: namespacelabs/nscloud-cache-action@v1 | ||
with: | ||
cache: go | ||
path: | | ||
/home/runner/go/pkg | ||
/home/runner/.cache/go-build | ||
/home/runner/.cache/golangci-lint | ||
- name: Find go path | ||
id: go-dir | ||
run: echo "path=$(go list -f '{{.Dir}}/...' -m | xargs)" >> $GITHUB_OUTPUT | ||
## Equivalent to 'make lint' arguments | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
version: v1.56.2 | ||
args: --timeout=10m --concurrency 8 -v ${{ steps.go-dir.outputs.path }} | ||
## skip cache, use Namespace volume cache | ||
skip-cache: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, edited, reopened] | ||
|
||
jobs: | ||
linr-pr-title: | ||
name: PR Title | ||
permissions: | ||
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs | ||
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,58 +2,45 @@ name: Test | |
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, edited, reopened] | ||
push: | ||
branches: | ||
- main | ||
workflow_call: | ||
|
||
env: | ||
GO_VERSION: 1.21.0 | ||
|
||
jobs: | ||
go-test: | ||
name: Run Go Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [1.21.x] | ||
test-unit-coverage: | ||
name: Unit & Coverage | ||
runs-on: namespace-profile-linux-4vcpu-8gb-cached | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Build | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
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: ${{ matrix.go-version }} | ||
cache-dependency-path: "go.sum" | ||
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: Test | ||
shell: 'script -q -e -c "bash {0}"' | ||
run: | | ||
go test ./... -coverprofile=coverage.out -covermode=count -v | ||
- name: Upload coverage results to Github artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage | ||
path: ./coverage.out | ||
|
||
upload-codecov: | ||
name: Upload coverage output to Codecov.io | ||
runs-on: ubuntu-latest | ||
needs: go-test | ||
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Download coverage output file | ||
uses: actions/download-artifact@v3 | ||
- name: Setup Namespace cache | ||
uses: namespacelabs/nscloud-cache-action@v1 | ||
with: | ||
name: coverage | ||
- name: Upload coverage output to Codecov | ||
uses: codecov/codecov-action@v3 | ||
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: "./" | ||
directory: "./" |
Oops, something went wrong.