-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (125 loc) · 4.34 KB
/
python-publish.yml
File metadata and controls
130 lines (125 loc) · 4.34 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
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
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
push:
branches: [main]
pull_request:
branches: [main]
repository_dispatch:
types: [test workflow]
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
image:
- 2024.3
- latest-cd
- latest-preview
engine:
- old
- new
driver:
- iris
- intersystems
runs-on: ubuntu-latest
services:
iris:
image: containers.intersystems.com/intersystems/iris-community:${{ matrix.image }}
ports:
- 1972:1972
options: >-
--name iris
--health-cmd "/usr/irissys/dev/Cloud/ICM/waitReady.sh -m 1"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install requirements
run: |
pip install tox
- name: Run Tests
continue-on-error: ${{ matrix.driver == 'intersystems' }}
run: |
docker exec iris iris session iris -U%SYS '##class(Security.Users).UnExpireUserPasswords("*")'
tox -e py312-${{ matrix.engine }}-${{ matrix.driver }} -- --dburi iris+${{ matrix.driver }}://_SYSTEM:SYS@localhost:1972/USER --junit-xml=test-results.xml
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
path: test-results.xml
summary: true
display-options: fEX
fail-on-empty: false
title: Test results
deploy:
needs: test
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
if: github.event_name == 'push'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
id: set-version
run: |
VERSION=$(grep version setup.cfg | cut -d= -f2 | tr -d '[:blank:]')
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b && VERSION+=$(($(git tag -l "*$VERSION*" | cut -db -f2 | sort -n | tail -1)+1))
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
echo VERSION = $VERSION
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
python -m pip install --upgrade pip
pip install build
echo version=$VERSION >> $GITHUB_OUTPUT
NAME="sqlalchemy_iris"-${VERSION}-py3-none-any
echo name=$NAME >> $GITHUB_OUTPUT
- name: Install requirements
run: |
pip install -U pip setuptools wheel \
-r requirements-dev.txt \
-r requirements-iris.txt \
-e .
- name: Build Python package
run: ./scripts/build-dist.sh
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create Beta Release
id: create_release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.set-version.outputs.version }}
prerelease: ${{ github.event_name != 'release' }}
files: dist/${{ steps.set-version.outputs.name }}.whl
- uses: actions/checkout@v4
if: github.event_name == 'release'
with:
ref: main
- name: Bump version
if: github.event_name == 'release'
run: |
git config --global user.name 'ProjectBot'
git config --global user.email 'bot@users.noreply.github.com'
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
git add setup.cfg
git commit -m 'auto bump version with release'
git push