Skip to content
Draft
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
118 changes: 0 additions & 118 deletions .circleci/config.yml

This file was deleted.

116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "*"

permissions:
contents: read

jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- "3.11"

steps:
- name: Check out repository
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install awscli
python -m pip install -e '.[test]'

- name: Check AWS credentials
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
if [ -z "$AWS_ACCESS_KEY_ID" ] || [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
echo "AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets are required to fetch test files." >&2
exit 1
fi

- name: Fetch test files
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: aws s3 cp s3://educreations-secrets/python-iap/ tests/. --recursive

- name: Run flake8
run: python -m flake8

- name: Run pytest
run: python -m pytest

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

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: setup.py

- name: Check release tag
id: release_tag
run: |
if [[ "$GITHUB_REF_NAME" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
echo "publish=true" >> "$GITHUB_OUTPUT"
else
echo "publish=false" >> "$GITHUB_OUTPUT"
echo "Tag $GITHUB_REF_NAME is not a version tag; skipping publish."
fi

- name: Check PyPI password
if: steps.release_tag.outputs.publish == 'true'
env:
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
if [ -z "$PYPI_PASSWORD" ]; then
echo "PYPI_PASSWORD secret is required to publish to PyPI." >&2
exit 1
fi

- name: Build package
if: steps.release_tag.outputs.publish == 'true'
run: |
python -m pip install --upgrade pip setuptools wheel
python setup.py sdist bdist_wheel

- name: Publish package
if: steps.release_tag.outputs.publish == 'true'
env:
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade twine
python -m twine upload --username streeter --password "$PYPI_PASSWORD" dist/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-iap

[![CircleCI](https://circleci.com/gh/educreations/python-iap.svg?style=svg)](https://circleci.com/gh/educreations/python-iap) [![PyPI version](https://badge.fury.io/py/iap.svg)](https://badge.fury.io/py/iap)
[![CI](https://github.com/educreations/python-iap/actions/workflows/ci.yml/badge.svg)](https://github.com/educreations/python-iap/actions/workflows/ci.yml) [![PyPI version](https://badge.fury.io/py/iap.svg)](https://badge.fury.io/py/iap)

Python utilities for working with Apple In-App Purchases (IAP)

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
author_email="engineering@educreations.com",
url="https://github.com/educreations/python-iap",
classifiers=[
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3",
packages=["iap"],
package_dir={"iap": "iap"},
install_requires=[
Expand Down
Loading