Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(actions): add compiled wheels to releases #9

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Publish Documentation
on:
push:
paths:
- .github/workflows/docs.yaml
- docs/**
- mkdocs.yml
- pyproject.toml
Expand Down Expand Up @@ -34,7 +35,7 @@ jobs:
uses: oprypin/[email protected]
with:
repository: ${{ github.repository }}
regex: '^\d+\.\d+\.\d+'
regex: '^\d+\.\d+\.\d+$'
releases-only: true

- name: Extract major and minor version
Expand Down
52 changes: 47 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,63 @@ jobs:
path: dist/


compile-wheels:
name: Compile Wheels
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3

- name: Version
id: version
run: echo "value=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
name: Cache pip dependencies
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install-dev

- name: Compile Wheel
run: make wheel version=${{ steps.version.outputs.value }}

- name: Upload Wheel
uses: actions/upload-artifact@v3
with:
name: built-artifacts
path: wheels/


upload-assets:
name: Upload Assets to Release
runs-on: ubuntu-22.04

needs: package
needs: compile-wheels

steps:
- uses: actions/download-artifact@v3
with:
name: built-artifacts
path: dist/
path: wheels/

- uses: AButler/[email protected]
with:
files: "dist/*"
files: "wheels/*"
repo-token: ${{ secrets.ACCESS_TOKEN }}
release-tag: ${{ needs.package.outputs.version }}

Expand All @@ -75,13 +117,13 @@ jobs:
name: Publish packages to PyPi
runs-on: ubuntu-22.04

needs: package
needs: compile-wheels

steps:
- uses: actions/download-artifact@v3
with:
name: built-artifacts
path: dist/
path: wheels/

- uses: pypa/[email protected]
with:
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VENV := $(PWD)/env
PYTHON := python
PIP := $(PYTHON) -m pip
PYV=$(shell $(PYTHON) -c "import sys;t='{v[0]}{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")

.PHONY: help venv3 clean

Expand Down Expand Up @@ -59,5 +60,11 @@ package: ### Builds the package in wheel format
$(PYTHON) -m build --wheel
twine check dist/*

wheel: ### Compiles the wheel
test -d wheels || mkdir -p wheels
cp dist/ydata_sdk-$(version)-py3-none-any.whl wheels/ydata_sdk-$(version)-py$(PYV)-none-any.whl
$(PYTHON) -m pyc_wheel wheels/ydata_sdk-$(version)-py$(PYV)-none-any.whl
twine check wheels/*

publish-docs: ### Publishes the documentation
mike deploy --push --update-aliases $(version) latest
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ dev = [
"black==22.8.0",
"flake8==6.0.0",
"isort==5.11.3",
"pre-commit==2.20.0"
"pre-commit==2.20.0",
"pyc_wheel",
vascoalramos marked this conversation as resolved.
Show resolved Hide resolved
]
doc = [
"mkdocs>=1.4.2,<2.0.0",
"mkdocs-material>=9.0.12,<10.0.0",
"mkdocs-material-extensions>=1.1.1,<2.0.0",
"mike>=1.1.2,<2.0.0",
"mkdocstrings[python]>=0.20.0,<1.0.0"
"mkdocstrings[python]>=0.20.0,<1.0.0",
]
test = [
"pytest==6.2.5",
Expand Down