forked from ramonvanalteren/jenkinsapi-old
-
Notifications
You must be signed in to change notification settings - Fork 485
92 lines (79 loc) · 2.74 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 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" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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@1f99358870fe1c846a3ccba386cc2b2246836776 # v2.2.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
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 }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Setup the Pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: >-
${{ matrix.python-version }}-pip-${{ hashFiles('setup.cfg') }}-${{
hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}-${{
hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ matrix.python-version }}-pip-
${{ matrix.python-version }}-
- 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