Skip to content

Commit

Permalink
Publish workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
shBLOCK committed Sep 6, 2023
1 parent 1fb6c6d commit 6496adf
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: PyPI

on:
release:
types: [published]

permissions:
contents: read

jobs:
pypi:
runs-on: windows-latest
steps:
- name: Download Assets
run: |
mkdir dists
gh release download ${{ github.ref_name }} --dir ./dists
- name: Upload
uses: pypa/gh-action-pypi-publish@release/v1.8.10
with:
packages-dir: dists/
repository-url: https://test.pypi.org/
password: ${{ secrets.TESTPYPI_TOKEN }}
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release

on:
push:
branches: [master]
tags: [v.*]

jobs:
prepare:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Codegen - Vector
run: python vector_codegen.py
working-directory: codegen

- name: Copy outputs to src
run: copy "codegen\output\*" "src\gdmath"

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: codegen_results
path: codegen/output/
retention-days: 1

- name: Create Release
run: gh release create ${{ github.ref_name }} --verify-tag --generate-notes --draft

source_dists:
runs-on: windows-latest
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Codegen Output
uses: actions/download-artifact@v3
with:
name: codegen_results
path: src/gdmath

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Build
run: python setup.py sdist --formats=gztar,zip

- name: Upload
run: gh release upload ${{ github.ref_name }} "./dist/*"

binary_dists:
runs-on: ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: true
matrix:
python: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
platform: [ "windows-latest", "ubuntu-latest", "macos-latest" ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Codegen Output
uses: actions/download-artifact@v3
with:
name: codegen_results
path: src/gdmath

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Build
run: python setup.py bdist_wheel

- name: Build (build twice to include .c files)
run: python setup.py bdist_wheel

- name: Upload
run: gh release upload ${{ github.ref_name }} "./dist/*"

# final_publish:
# runs-on: ubuntu-latest
# needs: [source_dists, binary_dists]
# steps:
# - name: Publish
# run: gh release edit ${{ github.ref_name }} --draft=false
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include src/gdmath/*.c
include src/gdmath/*.pyd
include src/gdmath/*.so
recursive-exclude tests *
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Cython >= 3.0.2
pytest >= 7.4.1
regex >= 2023.8.8
setuptools >= 68.0.0
twine >= 4.0.2
setuptools >= 68.0.0

0 comments on commit 6496adf

Please sign in to comment.