-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (110 loc) · 3.18 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# GitHub Actions Pipeline
name: 'YoYoCICD'
on:
pull_request:
branches:
- main
paths:
- yoyo/**
- tests/**
- .github/workflows/**
push:
branches:
- main
paths:
- yoyo/**
- tests/**
- .github/workflows/**
# Repo Permissions
permissions:
contents: write
issues: read
checks: write
pull-requests: write
jobs:
Test:
runs-on: 'ubuntu-latest'
steps:
- name: checkout repo content
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Upgrade package manager
run: python -m pip install -U pip
# Install dependencies
- name: install testing libraries
run: pip install pytest mock codecov pydocstyle pytest-cov pylint pylint_junit
- name: install project dependencies
run: python -m packages.sync
# Run tests
- name: Run tests
run: pytest -v tests/ --doctest-modules --junitxml=unit-testresults.xml --cov=yoyo/ --cov-append --cov-report=xml:xmlcov --cov-report=html:htmlcov
- name: Publish test reuslts
uses: EnricoMi/[email protected]
Build:
needs: Test
runs-on: 'ubuntu-latest'
steps:
- name: Checkout repo content
uses: actions/checkout@v2
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.12'
# Install dependencies
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install build dependencies
run: pip install build setuptools
- name: install project dependencies
run: python -m packages.sync
# Build
- name: Build distribution
run: python -m build --wheel
# Artifacts
- name: Get Current Pull Request
id: pr-check
uses: 8BitJonny/[email protected]
- name: Extract version
id: get_version
run: |
echo "Getting version from __init__.py..."
VERSION=$(python <<EOF
import yoyo
print(yoyo.__version__)
EOF
)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "current build : $VERSION"
echo "PR : ${{ steps.pr-check.outputs.number }}"
- name: Create release
if: ${{ steps.pr-check.outputs.number }} != 'null'
uses: ncipollo/[email protected]
with:
tag: "${{ steps.get_version.outputs.version }}"
allowUpdates: true
replacesArtifacts: true
# # PYPI API Key not yet configured
# Release:
# needs: Build
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.12
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install setuptools wheel twine
# - name: Build and publish
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
# run: |
# python setup.py sdist bdist_wheel
# twine upload dist/*