-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (69 loc) · 2.48 KB
/
build-cli-pkg.yml
File metadata and controls
79 lines (69 loc) · 2.48 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
name: Build & publish
on:
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
build:
runs-on: ["base-dind-2204-amd64"]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Find SHA
run: |
if [[ "${{github.event.pull_request.head.sha}}" != "" ]]
then
echo "ARTIFACT_SHA=$(echo ${{github.event.pull_request.head.sha}})" >> $GITHUB_ENV
echo "CI_COMMIT_TAG=0.0.0-${{ github.run_id }}" >> $GITHUB_ENV
else
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF##*/}"
echo "CI_COMMIT_TAG=$VERSION" >> $GITHUB_ENV
else
echo "CI_COMMIT_TAG=0.0.0+${GITHUB_SHA:0:7}" >> $GITHUB_ENV
#echo "ARTIFACT_SHA=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
#echo "CI_COMMIT_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
fi
- name: Install python dependencies
run: |
sudo apt update && sudo apt install -y python3.10-venv
python3 -m venv .venv
. .venv/bin/activate
.venv/bin/python3 -m pip install --upgrade pip
if [ -f requirements.txt ]; then .venv/bin/python3 -m pip install -r requirements.txt; fi
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# python3 -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#- name: Test with pytest
# env:
# PYTHONPATH: .
# run: |
# python3 -m build
# python3 -m pytest
#- name: Test with coverage
# env:
# PYTHONPATH: .
# run: |
# python3 -m pytest tests/
- name: Build pip package
run: |
. .venv/bin/activate
.venv/bin/python3 -m pip install build
cd mlsysops-cli
../.venv/bin/python3 -m build
VERSION=$(python3 setup.py --version)
PYVER=$(python3 --version | awk '{print $2}' | awk -F\. '{print $1 $2 }')
# FIXME: add pypi publish step
- name: Publish package
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: mlsysops-cli/dist