Skip to content

Commit fc64c4e

Browse files
committed
Add simple workflow to build, test and publish.
1 parent 8f987ad commit fc64c4e

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build, Test & Publush
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on all push or pull request events
8+
push:
9+
pull_request:
10+
11+
release:
12+
types: [created]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
schedule:
18+
- cron: "0 0 * * *"
19+
20+
# added using https://github.com/step-security/secure-repo
21+
permissions:
22+
contents: read
23+
24+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
25+
jobs:
26+
build_and_test_python:
27+
continue-on-error: true
28+
strategy:
29+
matrix:
30+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
31+
compiler: ['gcc', 'clang']
32+
os: [macos, ubuntu]
33+
# include:
34+
# Would be cool, but not yet :(. Someone, please make a PR.
35+
# - python-version: '3.10'
36+
# compiler: microsoft
37+
# os: windows
38+
# - python-version: '3.11'
39+
# compiler: microsoft
40+
# os: windows
41+
# - python-version: '3.12'
42+
# compiler: microsoft
43+
# os: windows
44+
45+
runs-on: ${{ matrix.os }}-latest
46+
env:
47+
COMPILER: ${{ matrix.compiler }}
48+
49+
# Steps represent a sequence of tasks that will be executed as part of the job
50+
steps:
51+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
52+
- uses: actions/checkout@v4
53+
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install dependencies
60+
run: |
61+
python -m pip install --upgrade pip
62+
pip install setuptools wheel
63+
shell: bash
64+
65+
- name: build
66+
run: CC=${COMPILER} LDSHARED="${COMPILER} -shared" python setup.py build sdist
67+
shell: bash
68+
69+
- name: install
70+
run: pip install dist/*.gz
71+
shell: bash
72+
73+
- name: test
74+
run: |
75+
python -m unittest discover tests '*.py'
76+
shell: bash
77+
78+
publish_wheels:
79+
needs: build_and_test_python
80+
if: github.event_name == 'release' && github.event.action == 'created'
81+
runs-on: ubuntu-latest
82+
environment:
83+
name: pypi
84+
url: https://pypi.org/p/asyncproxy
85+
permissions:
86+
id-token: write
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- name: Set up Python
91+
uses: actions/setup-python@v5
92+
with:
93+
python-version: '3.12'
94+
95+
- name: Install dependencies
96+
run: |
97+
python -m pip install --upgrade pip
98+
pip install setuptools wheel
99+
100+
- name: build
101+
run: python setup.py build sdist
102+
103+
- name: Publish package distributions to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)