-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (66 loc) · 2.49 KB
/
backend-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
name: Backend CI
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Automatically on push to main, test-workflow-implementation or dev
# And on pull request to main or dev
# Add more branches by separating with comma
push:
branches: [ "main", "tests-workflow-implementation", "dev" ]
pull_request:
branches: [ "main", "dev" ]
jobs:
Test-Backend-App:
runs-on: ubuntu-latest
#Environment used to access secrets
#environment: ENVIRONMENT_NAME_GOES_HERE
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Branch
uses: actions/checkout@v3
# Creates a .env file with the variables succeeding envkey_
# i.e: envkey_PORT: 8080
# creates: PORT=8080
# in the directory backend-app/
- name: Create .env file
uses: SpicyPizza/create-envfile@v1.3.0
with:
envkey_PORT: 8080
envkey_RUN_OCPP_TEST: 0
envkey_USE_LOCAL_DATABASE: 1
envkey_OCPP_TEST_INTERVAL_MULTIPLIER: 1
envkey_BYPASS_KLARNA: 1
envkey_LIVEMETRICS_DB_UPDATE_INTERVAL: 10000
envkey_AWS_REGION: ${{ secrets.AWS_REGION }}
envkey_USER_POOL: ${{ secrets.USER_POOL }}
envkey_USER_POOL_ID: ${{ secrets.USER_POOL_ID }}
envkey_USER_POOL_SECRET: ${{ secrets.USER_POOL_SECRET }}
envkey_DATABASE_NAME: "UNNEEDED"
envkey_DATABASE_USERNAME: "UNNEEDED"
envkey_DATABASE_PASSWORD: "UNNEEDED"
envkey_DATABASE_HOST: "UNNEEDED"
envkey_KLARNA_TOKEN: ${{ secrets.KLARNA_TOKEN }}
directory: backend-app/
# # Runs sequentially to starting the back-end app
# - name: Install requirements
# # Installs the requirements
# run: |
# export PYTHONPATH=.
# pip install -r ./test/requirements.txt
# Run the backend app
# & is used to signal that this task will keep running, as to not get stuck on this step
- name: launch docker container
run: |
docker-compose up --build -d
# Executes the tests within the /backend_tests folder
# - name: Run PyTest
# run: python -m pytest ./test/backend_tests --junit-xml=report.xml
- name: Run unit tests
run: |
docker exec flexicharge-backend "npm" "test"
# Displays a summary and overlook of test cases
- name: Publish test result
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/*.xml'