This repository was archived by the owner on Jan 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (76 loc) · 3.06 KB
/
DeployTesting.yml
File metadata and controls
97 lines (76 loc) · 3.06 KB
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
93
94
95
96
name: Deploy testing to Heroku-dev
'on':
push:
branches:
- testing
jobs:
Deploy-testing-to-Heroku:
runs-on: iiit-vm
environment: testing
steps:
- name: Adding local bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
# Needed when running on a new machine for the first time
# - name: Install system dependencies
# run: yes | sudo apt-get install libpq-dev python3-wheel gcc
- name: Installing poetry
run: which poetry || curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
- name: Installing pip packages
run: poetry install
- name: Running bandit tests
run: poetry run bandit -r ${{ github.workspace }}
- name: Running flake8 tests
run: poetry run flake8 ${{ github.workspace }} --exclude=migrations
- name: Creating environment variables
run: echo "SECRET_KEY=a">.env && echo "EMAIL=a">>.env && echo "CICD=True">>.env
- name: Setting git credentials
run: git config --global user.email "watsonhex@gmail.com" && git config --global user.name "Github runner"
- name: Run makemigrations
run: yes | poetry run python manage.py makemigrations
- name: Creating requirements.txt
run: poetry export -f requirements.txt --output requirements.txt --without-hashes
- name: Git add and commit
run: git add . && if [[ $(git status -s) ]]; then git commit -m "Migrations"; fi
- name: Heroku deploy
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_APP: ${{ secrets.HEROKU_APP_TESTING }}
run: dpl --provider=heroku --app=$HEROKU_APP --api-key=$HEROKU_API_KEY
shell: bash -ieo pipefail {0}
- name: Pushing to Github
run: git pull && git push
Create-issues-using-TODO:
runs-on: iiit-vm
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Checking out testing branch
run: git checkout testing
- name: Github login
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- name: Creating issues
run: readarray -t array <<< $(git diff HEAD^ --name-only -G "TODO" -- ':!:*.yml' | xargs --no-run-if-empty git
grep -n "TODO" --) && for command in "${array[@]}"; do
gh issue create --title "${command##*#}" --body "${command}" --label "todo" || echo "ERROR $(command)";
done
- name: Github logout
run: gh auth logout --hostname github.com
# Internal-deploy:
# runs-on: iiit-vm
# needs: Deploy-testing-to-Heroku
# steps:
#
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
#
# - name: Checking out testing branch
# run: git checkout testing && git pull
#
# - name: Adding remote
# run: git remote add production dokku@192.168.1.229:django-collabconnect || echo "Remote already exists"
#
# - name: Pushing
# run: git push production -f testing:main