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

updated workflows #12

Merged
merged 9 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
83 changes: 83 additions & 0 deletions .github/workflows/build_koheesio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: build koheesio

on:
push:
tags:
- koheesio-v*
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
APP_NAME: koheesio
PYTHON_VERSION: "3.12"
PYOXIDIZER_VERSION: "0.24.0"
DIST_URL: "https://github.com/Nike-Inc/koheesio/releases"

jobs:
python-artifacts:
name: Build wheel and source distribution
runs-on: ubuntu-latest

outputs:
old-version: ${{ steps.version.outputs.old-version }}
version: ${{ steps.version.outputs.version }}

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

- name: Install Hatch
uses: pypa/hatch@install

# Windows installers don't accept non-integer versions so we ubiquitously
# perform the following transformation: X.Y.Z.devN -> X.Y.Z.N
- name: Set project version
id: version
run: |-
old_version="$(hatch version)"
version="${old_version/dev/}"

echo "old-version=$old_version" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "$version"

- name: Build
run: hatch build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-artifacts
path: dist/*
if-no-files-found: error

publish-pypi:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: python-artifacts
runs-on: ubuntu-latest

steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist

- name: Publish package to TestPyPI
uses: pypa/[email protected]
with:
print-hash: true
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
repository-url: https://test.pypi.org/legacy/
38 changes: 19 additions & 19 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ jobs:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest] # FIXME: Add Windows and macOS
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
# pyspark-version: ['33', '34', '35']
# exclude:
# - python-version: '3.9'
# pyspark-version: '35'
# - python-version: '3.11'
# pyspark-version: '33'
# - python-version: '3.11'
# pyspark-version: '34'
# - python-version: '3.12'
# pyspark-version: '33'
# - python-version: '3.12'
# pyspark-version: '34'
pyspark-version: ['33', '34', '35']
exclude:
- python-version: '3.9'
pyspark-version: '35'
- python-version: '3.11'
pyspark-version: '33'
- python-version: '3.11'
pyspark-version: '34'
- python-version: '3.12'
pyspark-version: '33'
- python-version: '3.12'
pyspark-version: '34'

steps:
- uses: actions/checkout@v4
Expand All @@ -48,15 +48,15 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Ensure latest pip
run: python -m pip install --upgrade pip
- name: Install Hatch
uses: pypa/hatch@install

- name: Install hatch
run: pip install hatch
# - name: Check Code Quality
# run: |-
# hatch fmt --check --python=${{ matrix.python-version }}

- name: Run tests
# run: hatch run test --python=${{ matrix.python-version }} -i pyspark${{ matrix.pyspark-version }}
run: hatch test --python=${{ matrix.python-version }}
run: hatch test --python=${{ matrix.python-version }} -i version=pyspark${{ matrix.pyspark-version }}

# https://github.com/marketplace/actions/alls-green#why
final_check: # This job does nothing and is only used for the branch protection
Expand Down
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

from koheesio.logger import LoggingFactory

# force time zone to be UTC
os.environ["TZ"] = "UTC"
time.tzset()
if os.name != "nt": # 'nt' is the name for Windows
# force time zone to be UTC
os.environ["TZ"] = "UTC"
time.tzset()


@pytest.fixture(scope="session")
Expand Down