|
1 |
| -# This is a basic workflow to help you get started with Actions |
2 |
| - |
3 | 1 | name: CI
|
4 | 2 |
|
5 |
| -# Controls when the workflow will run |
6 | 3 | on:
|
7 |
| - # Triggers the workflow on push or pull request events but only for the main branch |
8 | 4 | push:
|
9 |
| - branches: [ main ] |
| 5 | + branches: [main] |
10 | 6 |
|
11 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
12 | 7 | jobs:
|
13 |
| - # This workflow contains a single job called "build" |
14 |
| - deploy: |
15 |
| - # The type of runner that the job will run on |
| 8 | + test: |
16 | 9 | runs-on: ubuntu-latest
|
17 |
| - |
18 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
| 10 | + services: |
| 11 | + postgres: |
| 12 | + image: postgres |
| 13 | + env: |
| 14 | + POSTGRES_USER: postgres |
| 15 | + POSTGRES_PASSWORD: postgres |
| 16 | + options: >- |
| 17 | + --health-cmd pg_isready |
| 18 | + --health-interval 10s |
| 19 | + --health-timeout 5s |
| 20 | + --health-retries 5 |
| 21 | + ports: |
| 22 | + # Maps TCP port 5432 on service container to the host |
| 23 | + - 5432:5432 |
| 24 | + env: |
| 25 | + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/proto |
| 26 | + JWT_TOKEN_SECRET: ${{ secrets.JWT_TOKEN_SECRET }} |
| 27 | + CLIENT_ID_GITHUB: ${{ secrets.CLIENT_ID_GITHUB }} |
| 28 | + CLIENT_SECRET_GITHUB: ${{ secrets.CLIENT_SECRET_GITHUB }} |
| 29 | + REDIRECT_URI_GITHUB: ${{ secrets.REDIRECT_URI_GITHUB }} |
| 30 | + FRONTEND_URL: ${{ secrets.FRONTEND_URL }} |
| 31 | + SESSION_SECRET: ${{ secrets.SESSION_SECRET }} |
| 32 | + JUDGE_API_URL: ${{ secrets.JUDGE_API_URL }} |
| 33 | + NODE_ENV: ${{ secrets.NODE_ENV }} |
19 | 34 | steps:
|
20 |
| - - name: Extract branch name |
21 |
| - shell: bash |
22 |
| - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
23 |
| - id: extract_branch |
24 |
| - |
25 |
| - - name: SSH Remote Commands |
26 |
| - |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + - uses: actions/setup-node@v1 |
27 | 37 | with:
|
28 |
| - host: ${{ secrets.HOST }} |
29 |
| - username: ${{ secrets.USERNAME }} |
30 |
| - password: ${{ secrets.PASSWORD }} |
31 |
| - script: | |
32 |
| - cd proto |
33 |
| - git checkout ${{ steps.extract_branch.outputs.branch }} |
34 |
| - git pull |
35 |
| - yarn run build |
36 |
| - yarn run start |
| 38 | + node-version: "16.13" |
| 39 | + - run: yarn run install |
| 40 | + - run: yarn run setup |
| 41 | + - run: cd backend && (yarn run test:dev & yarn run test) |
0 commit comments