-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (49 loc) · 1.45 KB
/
Copy pathbuild.yml
File metadata and controls
62 lines (49 loc) · 1.45 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
---
name: Build and Test
on: [push, pull_request]
concurrency: production # Make it so this job must complete for deployment to move forward
jobs:
pre-commit:
name: Pre-commit (linting)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
pytest-in-venv:
name: Python tests (in venv)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.1
cache: "pip"
- name: Install dependencies
run: |
pip install -r requirements-test.txt
- name: Test with pytest
run: |
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
deploy:
if: github.ref == 'refs/heads/master' # only run deploy on master
name: Deploy to production
runs-on: ubuntu-latest
environment: production
needs: [pre-commit, pytest-in-venv]
steps:
- name: Deploy via ssh
uses: appleboy/ssh-action@v1.0.0
with:
script: ~/update_teslabot.bash
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script_stop: true