-
Notifications
You must be signed in to change notification settings - Fork 76
86 lines (69 loc) · 1.99 KB
/
pythonCI.yml
File metadata and controls
86 lines (69 loc) · 1.99 KB
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
name: Python CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
outputs:
PACKAGE_VERSION: ${{ steps.set_version.outputs.package_version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Specify the Python version you need
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Set version
id: set_version
run: |
PACKAGE_VERSION=$(date +'%Y.%m.%d.%H%M%S')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "::set-output name=package_version::$PACKAGE_VERSION"
- name: Build wheel
env:
PACKAGE_VERSION: ${{ steps.set_version.outputs.package_version }}
run: |
cd datascience_project/myfirst_project
python setup.py sdist bdist_wheel
- name: List wheel files
run: |
ls -al datascience_project/myfirst_project/dist
- name: Create artifact
uses: actions/upload-artifact@v3
with:
name: wheel-files-${{ steps.set_version.outputs.package_version }}
path: datascience_project/myfirst_project/dist/*.whl
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Specify the Python version you need
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: wheel-files-${{ needs.build.outputs.PACKAGE_VERSION }}
path: dist
- name: List downloaded files
run: ls -al dist
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
- name: Run tests
run: |
pip install pytest
pytest