-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (48 loc) · 1.63 KB
/
build-ci.yml
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
name: CI
# This section controls when the workflow will run
on:
# Run the workflow on push to "main" branch
push:
branches: [ "main" ]
# Run the workflow on pull request to "main" branch and ready for review
pull_request:
branches: [ "main"]
types: [ready_for_review]
# Run the workflow manually
workflow_dispatch:
# This section controls which jobs the workflow will run
jobs:
run-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create venv and install requirements
run: |
python3 -m venv venv
. venv/bin/activate
pip3 install build --upgrade
python3 -m build
pip3 install ./dist/*.whl
- name: Run linter
run: |
. venv/bin/activate
pip3 install flake8
flake8 . --exclude=venv* --count --max-complexity=10 --max-line-length=79 --statistics
build-and-test:
runs-on: ubuntu-latest
env:
PRCOMMITSHA : ${{ github.event.pull_request.head.sha }}
steps:
- uses: actions/checkout@v3
- name: Print github context
run: echo $PRCOMMITSHA
- name: Docker build (pull request)
if: ${{ github.event.pull_request.head.sha != '' }}
run: docker build -t ci-sledo-ubuntu --build-arg build_git_sha=$PRCOMMITSHA docker/sledo-ubuntu/
- name: Docker build (push)
if: ${{ github.event.pull_request.head.sha == '' }}
run: docker build -t ci-sledo-ubuntu --build-arg build_git_sha=$GITHUB_SHA docker/sledo-ubuntu/
- name: Run tests
run: |
pip3 install pytest
pytest tests