Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
ci: add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanljones committed Mar 16, 2022
1 parent 9c364ef commit b2bede6
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/pypi-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries


name: Upload Python Package to TestPyPi

on:
# Triggers the workflow when a release is created
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-n-publish:
name: Build and publish Python Package to TestPyPi
runs-on: ubuntu-latest

steps:
- name: get latest release with tag
id: latestrelease
run: |
echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/dylanljones/cmpy/releases/latest --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.tag_name' | sed 's/\"//g')"
- name: confirm release tag
run: |
echo ${{ steps.latestrelease.outputs.releasetag }}
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.latestrelease.outputs.releasetag }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
pip install .[build]
- name: Build and publish distribution 📦 to Test PyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
36 changes: 36 additions & 0 deletions .github/workflows/test_versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test Installation

on:
push:
branches: [master, dev]
workflow_dispatch:

jobs:

build:
name: Build and install
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10"]
other-os: [false]

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.other-os }} # don't cancel due to OS specific failures
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build and install
run: |
python -m pip install --upgrade pip
pip install .
- name: Get package version
run: python setup.py --version

0 comments on commit b2bede6

Please sign in to comment.