forked from ramonvanalteren/jenkinsapi-old
-
Notifications
You must be signed in to change notification settings - Fork 487
75 lines (65 loc) · 2.26 KB
/
python-package.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: CI_TEST
on:
push:
paths:
- 'requirements.txt'
- '**.py'
- '**.yml'
pull_request:
branches: [ "master" ]
workflow_dispatch: # allow manual run
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
token: ["stable", "latest"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: block
allowed-endpoints: >
azure.archive.ubuntu.com:80
esm.ubuntu.com:443
files.pythonhosted.org:443
ftp-chi.osuosl.org:443
ftp-nyc.osuosl.org:443
get.jenkins.io:443
github.com:443
api.github.com:443
int.api.stepsecurity.io:443
mirror.xmission.com:443
motd.ubuntu.com:443
packages.microsoft.com:443
ppa.launchpadcontent.net:443
pypi.org:443
updates.jenkins-ci.org:80
updates.jenkins.io:443
updates.jenkins.io:80
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
sudo apt-get update; sudo apt-get install gcc libkrb5-dev
python -m pip install --upgrade pip
python -m pip install -r test-requirements.txt
python -m pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 jenkinsapi/ --count --select=E9,F63,F7,F82 --ignore F821,W503,W504 --show-source --statistics
flake8 jenkinsapi/ --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics
- name: Test with pytest
env:
JENKINS_VERSION: ${{ matrix.token }}
run: |
pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests