-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (85 loc) · 2.43 KB
/
test-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# test if ci
name: test-ci
on:
push: # Lors du push sur toutes les branches
branches:
- "*"
pull_request:
branches:
[develop,main]
jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Node.js dependencies
run: |
cd backend
npm i
npm run lint
cd ../frontend
npm i
npm run lint
- name: Run linters back
uses: wearerequired/lint-action@v2
with:
eslint_dir: ./backend
eslint: true
- name: Run linters front
uses: wearerequired/lint-action@v2
with:
eslint_dir: ./frontend
eslint: true
- name: CI
run: echo "This job's status is ${{ job.status }}."
test-back:
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: snowwild
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Goto back and run tests
run: cd backend && npm i && npm run testCI
docker:
needs: test-back
# if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
context: "{{defaultContext}}:backend"
tags: ${{ secrets.DOCKERHUB_USERNAME }}/backend:latest