-
Notifications
You must be signed in to change notification settings - Fork 646
74 lines (63 loc) · 2.4 KB
/
test.yaml
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
# This is a GitHub Actions yaml file.
# This file will build and test the application.
# The name of the workflow. This is the name that will be displayed on the Actions tab.
name: Run Tests
# The event that triggers the workflow.
# In GitHub Actions, the 'on' mapping is used to specify the events that will
# trigger the workflow. The on mapping is a required key in the workflow file
# and must be present in order to define when the workflow should run.
# In this case, this 'on':
# Triggers the workflow on a push or pull-request event to the 'main' or 'test-github-actions' branch.
# A new commit pushed to the branch is considered a push event.
on:
push:
branches:
- main
- test-github-actions
pull_request:
branches:
- main
- test-github-actions
workflow_dispatch:
# A job is a set of steps in a workflow that is executed on the same runner.
# Each step is either:
# - a shell script that will be executed
# - an action that will be run.
# Steps are executed in order and are dependent on each other.
# Since each step can share data from one step to another.
# For example, you can have a step that builds your application
# followed by a step that tests the application that was built.
jobs:
# This is the 'checkout-and-test' job.
# 1. checkout the repository code.
# 2. run the software tests.
build-and-test:
# Use an Ubuntu virtual machine to run the job.
runs-on: ubuntu-latest
# The 'strategy' key allows you to define a matrix of values that will be used to
# generate a build matrix.
strategy:
# The 'matrix' key is used to define the values that will be used to generate the build matrix.
matrix:
# The 'python-version' key is used to define the Python versions that will be used.
python-version: [3.8, 3.9]
# The steps that the job will execute.
steps:
# Checkout the repository code.
- name: Checkout code
uses: actions/checkout@v2
# Set up Python.
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
# Install dependencies.
- name: Install dependencies
run: pip install -r requirements.txt
# Install pytest.
- name: Install pytest
run: pip install pytest
# Run the tests.
- name: Run tests
run: |
pytest -v