Skip to content

Commit 2c486b6

Browse files
committed
ci: improve CI/CD pipeline configuration
- Add pytest and pytest-cov to requirements.txt - Add coverage report upload to CI workflow - Add dependency between test and deploy jobs - Use Heroku official GitHub action for deployment - Remove container-related commands
1 parent 8372ee8 commit 2c486b6

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

.github/workflows/cd.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,23 @@ on:
66
- feature/heroku
77

88
jobs:
9+
test:
10+
uses: ./.github/workflows/ci.yml
11+
912
deploy:
10-
needs: test
13+
needs: test
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v2
14-
15-
- name: Install Heroku CLI
16-
run: |
17-
curl https://cli-assets.heroku.com/install.sh | sh
18-
19-
- name: Login to Heroku Container Registry
20-
env:
21-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
22-
run: heroku container:login
23-
24-
- name: Set Heroku stack to container
25-
env:
26-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
27-
run: heroku stack:set container -a github-commit-monitor
28-
29-
- name: Build and push
30-
env:
31-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
32-
run: |
33-
heroku container:push web -a github-commit-monitor
34-
heroku container:release web -a github-commit-monitor
35-
36-
- name: Set environment variables
17+
18+
- name: Deploy to Heroku
19+
uses: akhileshns/heroku-deploy@v3.12.14
20+
with:
21+
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
22+
heroku_app_name: "github-commit-monitor"
23+
heroku_email: ${{ secrets.HEROKU_EMAIL }}
24+
25+
- name: Set Heroku config vars
3726
env:
3827
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
3928
run: |

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ jobs:
2020
with:
2121
python-version: '3.9'
2222

23-
- name: Upgrade pip and setuptools
24-
run: |
25-
python -m pip install --upgrade pip setuptools
26-
2723
- name: Install dependencies
2824
run: |
25+
python -m pip install --upgrade pip
2926
pip install -r requirements.txt
3027
3128
- name: Run tests
3229
env:
3330
MY_GITHUB_SECRET: ${{ secrets.MY_GITHUB_SECRET }}
3431
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
3532
run: |
36-
python -m pytest --cov=app tests/ --cov-report=html
33+
python -m pytest --cov=app tests/ --cov-report=html
34+
35+
- name: Upload coverage reports
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: coverage-report
39+
path: htmlcov/

0 commit comments

Comments
 (0)