Skip to content

Commit

Permalink
GitHub actions backend tests (#304)
Browse files Browse the repository at this point in the history
* add test for HandleHTTPError

undelete

* more verbose http codes

* Update Dockerfile

Now using go 1.23! Tested this on dev, it works

* Update compose_dev.sh

Prints initial settings as defined in setup.yaml. Added for usability reasons - users keep getting confused about account balance and maximum allowable debt

* add failure condition test

* formatting and test standards

* add frontend file polling for wsl2

* add workflow files

* dependencies need backend working directory

* add macos testing

* macos

* backend test workflow

* change name

* Add test for HandleHTTPError (#278)

* add test for HandleHTTPError

undelete

* more verbose http codes

* Update Dockerfile

Now using go 1.23! Tested this on dev, it works

* Update compose_dev.sh

Prints initial settings as defined in setup.yaml. Added for usability reasons - users keep getting confused about account balance and maximum allowable debt

* add failure condition test

* formatting and test standards

---------

Co-authored-by: Osnat Katz Moon <[email protected]>

* add failure condition test (#282)

* Creation of Market Price Projection API (#277)

* Moving test to appropriate location.

* Updating, including moving test location. Test not passing due to precision error but generally passing on the terminal up to 6 dits.

* market projection handler, not working.

* Update market projected probability.

* Safe uint conversion.

* Updating, adding noop change to push into pipeline.

* Update, test passing.

* Update, attempting to solve type converstion uint problem.

* Adding projected market layout.

* Update, still have react JSON parse error but layout added to buyshares.

* Market projection updates on buy shares side, upon button press.

* Update, change printf to print.

* Create SECURITY.md

* Adding Fees to Buying and Selling Bets (#287)

* Drafting out fees deduction functions and capability.

* Attempting working version of initialBetFee function.

* Draft adding fees.

* Update, adding tests.

* Adding working test for GetBetsForMarket

* Successful fee util test.

* Fees added on backend, tests passing.

* Updating such that user record submitted. However fee summing not working yet evidently.

* Working fees, at least initial fees.

* Updating test scenario passing, made more clear.

* Update Dockerfile

We need to switch to 3.0.14-1~deb12u2

* Removing logging.

* Adding fees, including communicating fees on front end.

* totalBetCount to userBetCount so as not to misconstrue meaning.

* Simplifying function, test passed.

* Simplifying naming.

* Updating new function name in test

* Changing test to got before want convention.

* Update marketid variable

* Add combined fee structure for more througough test.

* Reverting sale amount to 1 share.

* Reversing got want

---------

Co-authored-by: Osnat Katz Moon <[email protected]>

* Frontend fixes (#286)

* fix: fixed the market buttons not showing on mobile

* fix: removed trade button on closed market

---------

Co-authored-by: Patrick Delaney <[email protected]>

* Attempting toa ddress cors related security concern. (#298)

* Drafting out reporting stats.

* Add support for dependency injection to setup (#301)

* Make EconomicsConfig from component structs

Auto initialize config
Add support to inject config
Add support for testing the setup through test doubles
Use new fee for placing bets (EachBetFee)

---------

Co-authored-by: Osnat Katz Moon <[email protected]>
Co-authored-by: Patrick Delaney <[email protected]>
Co-authored-by: Marko Kovač <[email protected]>
Co-authored-by: Arthur <[email protected]>
  • Loading branch information
5 people authored Sep 15, 2024
1 parent 55cd3cc commit 0a50b05
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Backend

on:
pull_request:
branches: [main]
workflow_dispatch:

concurrency:
group: "linux-test"
cancel-in-progress: true

jobs:
smoke:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [ '1.23.x' ]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Get Dependencies
working-directory: ./backend
run: |
go mod download
- name: Run tests
working-directory: ./backend
run: |
go build -o ./main && ./main &
SERVER_PID=$!
sleep 10
kill $SERVER_PID
unit:
needs: smoke
if: |
startsWith(github.head_ref, 'feature/')
|| startsWith(github.head_ref, 'fix/')
|| startsWith(github.head_ref, 'refactor/')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [ '1.23.x' ]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Get Dependencies
working-directory: ./backend
run: |
go get .
- name: Run tests
working-directory: ./backend
run: go test ./...
97 changes: 97 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17",
"is-wsl": "^3.1.0",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.1.7"
}
}
}
10 changes: 10 additions & 0 deletions frontend/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import { defineConfig } from 'vite';
import isWsl from 'is-wsl';
import react from '@vitejs/plugin-react';

export default defineConfig(() => {
let watchWSL = isWsl ? {
watch: {
usePolling: true,
interval: 500,
binaryInterval: 1000,
}
} : null;

return {
build: {
outDir: 'build',
},
plugins: [react()],
server: watchWSL,
};
});
1 change: 0 additions & 1 deletion scripts/docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,3 @@ networks:
driver: bridge
frontend_network:
driver: bridge

0 comments on commit 0a50b05

Please sign in to comment.