-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.52 KB
/
tests_api.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
name: Run Tests
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions: write-all
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.MY_GH_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '17'
- name: Install dependencies
run: npm install
- name: Run tests
env:
URI_MONGO: ${{ secrets.URI_MONGO }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
JWT_REFRESH: ${{ secrets.JWT_REFRESH }}
CLOUD_NAME: ${{ secrets.CLOUD_NAME }}
API_KEY: ${{ secrets.API_KEY }}
API_SECRET: ${{ secrets.API_SECRET }}
USER: ${{ secrets.USER }}
PASSWORD: ${{ secrets.PASSWORD }}
PLANTILLA: ${{ secrets.PLANTILLA }}
SMS_TOKEN: ${{ secrets.SMS_TOKEN }}
run: |
set +e
set NODE_OPTIONS=--experimental-vm-modules && npx jest
TEST_RESULT=$?
set -e
if [ $TEST_RESULT -ne 0 ]; then
echo "Tests failed. Reverting to previous version..."
git config --global user.email "[email protected]"
git config --global user.name "rodrigo3829l"
git reset --hard HEAD^
git push https://github.com/rodrigo3829l/db_api_mygarden_llc.git --force
else
echo "Tests passed."
fi