Skip to content

Commit

Permalink
add github actions (#96)
Browse files Browse the repository at this point in the history
## tl;dr

- Adds Github actions
- Adds shellcheck script
- Updates vscode config to use the correct lint tool
  • Loading branch information
neekolas authored Jul 29, 2024
2 parents be31c0b + b53a906 commit f1c599e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: shellcheck
run: |
sudo apt-get -y install tree
dev/lint-shellcheck
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m --config dev/.golangci.yaml
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- run: dev/docker/up
- name: Run Tests
run: |
export GOPATH="${HOME}/go/"
export PATH="${PATH}:${GOPATH}/bin"
go install github.com/jstemmer/go-junit-report/v2@latest
go test -v ./... | go-junit-report -set-exit-code -iocopy -out report.xml
- name: Run Race Tests
run: |
export GOPATH="${HOME}/go/"
export PATH="${PATH}:${GOPATH}/bin"
go test -v ./... -race
- uses: datadog/junit-upload-github-action@v1
with:
api-key: ${{ secrets.DD_API_KEY }}
service: xmtp-node-go
files: report.xml
env: ci
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"pgFormatter.typeCase": "uppercase",
"pgFormatter.tabs": true,
"[sql]": {
Expand Down
5 changes: 5 additions & 0 deletions dev/lint-shellcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

read -ra shellcheck_paths <<< "$(grep -rIzl '^#!' dev)"
shellcheck -x "${shellcheck_paths[@]}"

0 comments on commit f1c599e

Please sign in to comment.