diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9a32dac94e..a91572ad78 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -16,16 +16,16 @@ jobs: services: postgres: - image: postgres:10-alpine + image: postgres:12.2-alpine ports: - - 5432:5432 + - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust redis: - image: redis:alpine + image: redis:4.0-alpine ports: - - 6379:6379 + - 56312:6379 steps: - uses: actions/checkout@v2 @@ -40,7 +40,7 @@ jobs: - name: Check yarn.lock run: git diff --exit-code yarn.lock - name: Copy Configure - run: cp .circleci/misskey/*.yml .config + run: cp test/test.yml .config - name: Build run: yarn build - name: Test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06154f1f44..f5e0eece1f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,6 +57,17 @@ If your language is not listed in Crowdin, please open an issue. - Test codes are located in [`/test`](/test). ### Run test +Create a config file. +``` +cp test/test.yml .config/ +``` +Prepare DB/Redis for testing. +``` +docker-compose -f test/docker-compose.yml up +``` +Alternatively, prepare an empty (data can be erased) DB and edit `.config/test.yml`. + +Run all test. ``` npm run test ``` diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 0000000000..c045e7c6c4 --- /dev/null +++ b/test/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3" + +services: + redistest: + image: redis:4.0-alpine + ports: + - "127.0.0.1:56312:6379" + + dbtest: + image: postgres:12.2-alpine + ports: + - "127.0.0.1:54312:5432" + environment: + POSTGRES_DB: "test-misskey" + POSTGRES_HOST_AUTH_METHOD: trust diff --git a/test/test.yml b/test/test.yml new file mode 100644 index 0000000000..2d3094653e --- /dev/null +++ b/test/test.yml @@ -0,0 +1,12 @@ +url: 'http://misskey.local' +port: 61812 +db: + host: localhost + port: 54312 + db: test-misskey + user: postgres + pass: '' +redis: + host: localhost + port: 56312 +id: aid