Skip to content

Commit

Permalink
switch to manual trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
gijzelaerr committed Jul 5, 2024
1 parent 9c61b68 commit c31f6df
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 13 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: pre-commit
name: Run pre-commit hook
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
pre-commit:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: pre-commit/action@v3.0.1
86 changes: 86 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish distribution 📦 to PyPI

on:
workflow_dispatch:

jobs:
publish-to-testpypi:
environment:
name: pypi
url: https://pypi.org/p/python-snap7

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

name: Publish distribution 📦 toPyPI
runs-on: ubuntu-latest
steps:
- name: "Download macOS artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: dist
- name: "Download Linux/amd64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: .
- name: "Download Linux/arm64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: linux-build-test-arm64.yml
path: .
- name: "Download Windows artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: windows-build-test-amd64.yml
path: .
- name: "Download source artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: source-build.yml
path: .
- name: Combine artifacts
uses: actions/upload-artifact@v4
with:
path: dist
- name: show dist layout
run: |
ls -al
ls -al dist
find dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
test-pypi-packages:
runs-on: ${{ matrix.os }}
needs: publish-to-testpypi
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-14, macos-12, windows-2022, windows-2019]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install python-snap7[test]
- name: Run pytest
run: |
venv/bin/pytest -m "server or util or client or mainloop"
- name: Run tests required sudo on Linux and macOS
if: ${{ runner.os == 'Linux' || runner.os == 'macOS'}}
run: sudo venv/bin/pytest -m partner

- name: On windows we don't need sudo
if: ${{ runner.os == 'Windows'}}
run: venv/bin/pytest -m partner
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
name: Publish distribution 📦 to Test PyPI

on:
workflow_run:
workflows:
- "Build and test wheels linux/amd64"
- "Build and test wheels linux/arm64"
- "Build and test wheels osx/amd64"
- "Build and test wheels windows/amd64"
types:
- completed
workflow_dispatch:

jobs:
publish-to-testpypi:
Expand Down

0 comments on commit c31f6df

Please sign in to comment.