-
Notifications
You must be signed in to change notification settings - Fork 4
119 lines (112 loc) · 4.89 KB
/
create-release-n-publish.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
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
name: Release and Publish
on:
push: # It has to be push, otherwise error happens in code below.
branches: [ "main" ]
# branches: [ "main", "dev" ] # use this only to test the CI. If testing this CI, consider commenting out the automatic version updates and manually adjust the patch version.
#branches: [ "disabled" ]
jobs:
build:
name: Create Release and Publish
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v6
- name: Update version.py
run: |
export PYTHONPATH=$PYTHONPATH:flowcept
export BRANCH_NAME="${{ steps.branch-name.outputs.current_branch }}"
python .github/workflows/version_bumper.py
- name: Commit new version
run: |
git config --global user.name 'Flowcept CI Bot'
git config --global user.email '[email protected]'
git branch
git add src/flowcept/version.py
git commit -m "Flowcept CI Bot: bumping master version"
git push --force
- name: Get Latest PR and Create Release
run: |
export CURRENT_VERSION=`python -c "f = open('src/flowcept/version.py'); exec(f.read()); print(locals()['__version__']); f.close()"`
echo $CURRENT_VERSION
REPOSITORY=${{ github.repository }}
ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}
TARGET=${{ steps.branch-name.outputs.current_branch }}
echo "REPOSITORY=$REPOSITORY"
echo "TARGET=$TARGET"
echo "CURRENT_VERSION=${CURRENT_VERSION}"
echo "Get latest PR"
LATEST_PR_JSON=`curl -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
"https://api.github.com/repos/${REPOSITORY}/pulls?state=all&per_page=1&sort=created&base=main&direction=desc"`
LATEST_PR=`echo $LATEST_PR_JSON | python -c "import json, sys; data = json.load(sys.stdin); print(data[0]['html_url'])"`
echo "Latest PR: ${LATEST_PR}"
echo "Now Release the version"
curl --data "{\"tag_name\": \"v${CURRENT_VERSION}\",
\"target_commitish\": \"${TARGET}\",
\"name\": \"v${CURRENT_VERSION}\",
\"body\": \"Release of version ${CURRENT_VERSION}.\nRun \`pip install flowcept==${CURRENT_VERSION}\` to install this version.\n\nFor more details about the latest changes in this version, see the latest Pull Request's commits to the main branch: ${LATEST_PR}.\",
\"make_latest\": \"true\",
\"draft\": false,
\"prerelease\": false}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
https://api.github.com/repos/${REPOSITORY}/releases
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
verbose: true
- name: Publish distribution to PyPI
#if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
- name: Wait pypi do its thing
run: sleep 120
- name: Test pip install
run: pip install flowcept
- name: Print installed version
run: pip list | grep flowcept
- name: Test pip install one adapter
run: pip install flowcept[dask]
- name: Test pip install multiple adapters
run: pip install flowcept[mlflow,tensorboard]
- name: Install our dependencies
run: pip install flowcept[all]
- name: Install ml_dev dependencies
run: pip install flowcept[ml_dev]
- name: Pip list
run: pip list
- name: Run Docker Compose
run: docker compose -f deployment/compose.yml up -d
- name: Test with pytest
run: pytest --ignore=tests/decorator_tests/ml_tests/llm_tests
- name: Test notebooks
run: |
# export FLOWCEPT_SETTINGS_PATH=~/.flowcept/settings.yaml
python src/flowcept/flowcept_webserver/app.py &
sleep 3
pytest --nbmake "notebooks/" --nbmake-timeout=600 --ignore=notebooks/dask_from_CLI.ipynb