Skip to content

Commit 2238cbc

Browse files
committed
ci: Add python pkg build job
Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
1 parent 8bdcdee commit 2238cbc

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build & publish
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ["base-dind-2204-amd64"]
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
submodules: recursive
18+
19+
- name: Find SHA
20+
run: |
21+
if [[ "${{github.event.pull_request.head.sha}}" != "" ]]
22+
then
23+
echo "ARTIFACT_SHA=$(echo ${{github.event.pull_request.head.sha}})" >> $GITHUB_ENV
24+
echo "CI_COMMIT_TAG=0.0.0" >> $GITHUB_ENV
25+
else
26+
echo "ARTIFACT_SHA=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
27+
echo "CI_COMMIT_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
28+
fi
29+
30+
- name: Install python dependencies
31+
run: |
32+
sudo apt update && sudo apt install -y python3.10-venv
33+
python3 -m venv .venv
34+
. .venv/bin/activate
35+
.venv/bin/python3 -m pip install --upgrade pip
36+
if [ -f requirements.txt ]; then .venv/bin/python3 -m pip install -r requirements.txt; fi
37+
38+
#- name: Lint with flake8
39+
# run: |
40+
# # stop the build if there are Python syntax errors or undefined names
41+
# python3 -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42+
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43+
# python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
44+
45+
#- name: Test with pytest
46+
# env:
47+
# PYTHONPATH: .
48+
# run: |
49+
# python3 -m build
50+
# python3 -m pytest
51+
52+
#- name: Test with coverage
53+
# env:
54+
# PYTHONPATH: .
55+
# run: |
56+
# python3 -m pytest tests/
57+
58+
- name: Build pip package
59+
run: |
60+
. .venv/bin/activate
61+
.venv/bin/python3 -m pip install build
62+
.venv/bin/python3 -m build
63+
VERSION=$(python3 setup.py --version)
64+
PYVER=$(python3 --version | awk '{print $2}' | awk -F\. '{print $1 $2 }')
65+
66+
# FIXME: add pypi publish step
67+
- name: Publish package
68+
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
69+
uses: pypa/gh-action-pypi-publish@release/v1
70+
with:
71+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ jobs:
2424
uses: ./.github/workflows/validate-files-and-commits.yml
2525
secrets: inherit
2626

27+
build-agent-pkg:
28+
#needs: [validate-files-and-commits, lint]
29+
name: Build
30+
if: |
31+
contains(github.event.pull_request.labels.*.name, 'ok-to-test') &&
32+
!contains(github.event.pull_request.labels.*.name, 'skip-build')
33+
uses: ./.github/workflows/build-mlsysops-pkg.yml
34+
secrets: inherit
35+
2736
# lint:
2837
# name: Lint code
2938
# if: |

0 commit comments

Comments
 (0)