ci: fix failing tests
This commit is contained in:
parent
9175fc2ea3
commit
64ef0c19d8
|
@ -1,4 +1,4 @@
|
||||||
name: API
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -6,9 +6,9 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
api-build:
|
api-build:
|
||||||
name: Build
|
name: API
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: golang:1.17
|
container: golang:1.17-buster
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -28,7 +28,7 @@ jobs:
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
redis:
|
redis:
|
||||||
image: redis:6.2-alpine
|
image: redis:6-alpine
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
defaults:
|
defaults:
|
||||||
|
@ -39,17 +39,8 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: cache go modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Installling dependencies
|
- name: Installling dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: go mod download
|
||||||
run: go mod vendor
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build main.go
|
run: go build main.go
|
||||||
|
@ -84,3 +75,51 @@ jobs:
|
||||||
- uses: codecov/codecov-action@v2
|
- uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
flags: api
|
flags: api
|
||||||
|
|
||||||
|
client-build:
|
||||||
|
name: Client
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: node:14-buster
|
||||||
|
timeout-minutes: 15
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./client
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Yarn
|
||||||
|
run: npm install -g yarn
|
||||||
|
|
||||||
|
- name: Installling dependencies
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: yarn lint
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: yarn build
|
||||||
|
env:
|
||||||
|
VITE_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
|
||||||
|
VITE_NODE_ENV: development
|
||||||
|
VITE_API_ENDPOINT: https://jokesbapak2.herokuapp.com/v1
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: javascript
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
||||||
|
- name: Create Sentry release
|
||||||
|
uses: getsentry/action-release@v1
|
||||||
|
env:
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
|
||||||
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||||
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_CLIENT }}
|
||||||
|
with:
|
||||||
|
environment: production
|
||||||
|
set_commits: skip
|
||||||
|
version: ${{ github.sha }}
|
|
@ -1,68 +0,0 @@
|
||||||
name: Client
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
client-build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: ./client
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v2.1.5
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
|
|
||||||
- name: cache node_modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Installling dependencies
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: yarn
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: yarn lint
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: yarn build
|
|
||||||
env:
|
|
||||||
VITE_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
|
|
||||||
VITE_NODE_ENV: development
|
|
||||||
VITE_API_ENDPOINT: https://jokesbapak2.herokuapp.com/v1
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: javascript
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
- name: Create Sentry release
|
|
||||||
uses: getsentry/action-release@v1
|
|
||||||
env:
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
|
|
||||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
||||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_CLIENT }}
|
|
||||||
with:
|
|
||||||
environment: production
|
|
||||||
set_commits: skip
|
|
||||||
version: ${{ github.sha }}
|
|
|
@ -8,6 +8,7 @@ jobs:
|
||||||
client-build:
|
client-build:
|
||||||
name: Client
|
name: Client
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container: node:14-buster
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
|
@ -17,26 +18,11 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Yarn
|
||||||
uses: actions/setup-node@v2.1.5
|
run: npm install -g yarn
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
|
|
||||||
- name: cache node_modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
|
|
||||||
- name: Installling dependencies
|
- name: Installling dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: yarn install
|
||||||
run: yarn
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npx eslint --ext .svelte,.js,.ts --ignore-path .gitignore .
|
run: npx eslint --ext .svelte,.js,.ts --ignore-path .gitignore .
|
||||||
|
@ -62,7 +48,7 @@ jobs:
|
||||||
api-build:
|
api-build:
|
||||||
name: API
|
name: API
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: golang:1.17
|
container: golang:1.17-buster
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -82,7 +68,7 @@ jobs:
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
redis:
|
redis:
|
||||||
image: redis:6.2-alpine
|
image: redis:6-alpine
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
defaults:
|
defaults:
|
||||||
|
@ -93,17 +79,8 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: cache go modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Installling dependencies
|
- name: Installling dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
run: go mod download
|
||||||
run: go mod vendor
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build main.go
|
run: go build main.go
|
||||||
|
|
|
@ -20,7 +20,25 @@ func TestGetSubmittedItems(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer c.Release()
|
defer c.Release()
|
||||||
|
|
||||||
_, err = c.Exec(ctx, "INSERT INTO submission (id, link, created_at, author, status) VALUES ($1, $2, $3, $4, $5), ($6, $7, $8, $9, $10)", submissionData...)
|
tx, err := c.Begin(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("an error was thrown:", err)
|
||||||
|
}
|
||||||
|
defer tx.Rollback(ctx)
|
||||||
|
|
||||||
|
_, err = tx.Exec(
|
||||||
|
ctx,
|
||||||
|
`INSERT INTO submission
|
||||||
|
(id, link, created_at, author, status)
|
||||||
|
VALUES
|
||||||
|
($1, $2, $3, $4, $5),
|
||||||
|
($6, $7, $8, $9, $10)`,
|
||||||
|
submissionData...)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("an error was thrown:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tx.Commit(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("an error was thrown:", err)
|
t.Error("an error was thrown:", err)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +73,12 @@ func TestGetterQueryBuilder(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if s != "SELECT * FROM submission WHERE TRUE AND author = $1 AND status = $2 LIMIT 15 OFFSET 10" {
|
if s != "SELECT * FROM submission WHERE TRUE AND author = $1 AND status = $2 LIMIT 15 OFFSET 10" {
|
||||||
t.Error("expected query to be", "SELECT * FROM submission WHERE TRUE AND author = $1 AND status = $2 LIMIT 15 OFFSET 15", "got:", s)
|
t.Error(
|
||||||
|
"expected query to be",
|
||||||
|
"SELECT * FROM submission WHERE TRUE AND author = $1 AND status = $2 LIMIT 15 OFFSET 15",
|
||||||
|
"got:",
|
||||||
|
s,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if i[0].(string) != "Test <example@test.com>" {
|
if i[0].(string) != "Test <example@test.com>" {
|
||||||
|
|
Loading…
Reference in New Issue