-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGithub Actions
More file actions
61 lines (52 loc) · 1.8 KB
/
Github Actions
File metadata and controls
61 lines (52 loc) · 1.8 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
# https://docs.github.com/en/actions/quickstart
# https://blog.deepjyoti30.dev/tests-github-python
# Example:
# 1. create .github/workflos directory
# 2. add github-actions.yml file
# 3. write the yml file with the jobs to run, see example below:
name: Run tests
run-name: ${{ github.actor }} is running the tests-suite with GitHub Actions 🚀
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- name: Install requirements
run:
python -m pip install --upgrade pip
pip install -r .requirements.txt
- name: Run tests
run: pytest tests/test*
- run: echo "🍏 This job's status is ${{ job.status }}."
# context variables: https://docs.github.com/en/actions/learn-github-actions/contexts
#### Add automatic formatting using black library:
# https://towardsdatascience.com/black-with-git-hub-actions-4ffc5c61b5fe
name: Format code
on:
push:
branches: [ master ]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Format code with black
run: |
pip install black
black .
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: ${{ github.actor }}
author_email: ${{ github.actor }}@users.noreply.github.com
message: "Format code with black"
add: "."
branch: ${{ github.ref }}