-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45cf3a1
commit b382505
Showing
2 changed files
with
94 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: "orakl node test" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "master" | ||
paths: | ||
- "node/**" | ||
jobs: | ||
core-build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 3 | ||
|
||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: orakl-test | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
redis: | ||
image: redis | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 6379:6379 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21.5" | ||
check-latest: true | ||
cache-dependency-path: | | ||
./node/go.sum | ||
- name: Run lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54 | ||
working-directory: node | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
args: --timeout=10m | ||
|
||
- name: Run Vet | ||
run: | | ||
cd ./node | ||
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest | ||
go vet | ||
go vet -vettool=$(which shadow) | ||
- name: Install golang-migrate | ||
run: | | ||
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.0/migrate.linux-amd64.tar.gz | tar xvz | ||
sudo mv ./migrate /usr/bin | ||
- name: Migrate up | ||
run: | | ||
cd ./node | ||
migrate -database "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public&sslmode=disable" -verbose -path ./migrations up | ||
- name: Install dependencies | ||
run: | | ||
cd ./node | ||
go mod tidy | ||
- name: Install task | ||
run: | | ||
sudo snap install task --classic | ||
- name: Run test | ||
run: | | ||
cd ./node | ||
task local:test | ||
env: | ||
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/orakl-test?search_path=public" | ||
REDIS_HOST: "localhost" | ||
REDIS_PORT: "6379" |
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 |
---|---|---|
|
@@ -9,3 +9,7 @@ tasks: | |
dotenv: [".env"] | ||
cmds: | ||
- go test ./pkg/admin/tests -v | ||
test: | ||
cmds: | ||
- task: test-db | ||
- task: test-admin |