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

Commit b2bede6

Browse files
committed
ci: add GitHub workflows
1 parent 9c364ef commit b2bede6

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
5+
name: Upload Python Package to TestPyPi
6+
7+
on:
8+
# Triggers the workflow when a release is created
9+
release:
10+
types: [published]
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
build-n-publish:
16+
name: Build and publish Python Package to TestPyPi
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: get latest release with tag
21+
id: latestrelease
22+
run: |
23+
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')"
24+
25+
- name: confirm release tag
26+
run: |
27+
echo ${{ steps.latestrelease.outputs.releasetag }}
28+
29+
- name: checkout
30+
uses: actions/checkout@v2
31+
with:
32+
ref: ${{ steps.latestrelease.outputs.releasetag }}
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: "3.10"
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install twine
43+
pip install .[build]
44+
45+
- name: Build and publish distribution 📦 to Test PyPI
46+
env:
47+
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
48+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
49+
run: |
50+
python setup.py sdist bdist_wheel
51+
twine upload --repository testpypi dist/*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test Installation
2+
3+
on:
4+
push:
5+
branches: [master, dev]
6+
workflow_dispatch:
7+
8+
jobs:
9+
10+
build:
11+
name: Build and install
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest]
15+
python-version: ["3.10"]
16+
other-os: [false]
17+
18+
runs-on: ${{ matrix.os }}
19+
continue-on-error: ${{ matrix.other-os }} # don't cancel due to OS specific failures
20+
env:
21+
OS: ${{ matrix.os }}
22+
PYTHON: ${{ matrix.python-version }}
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Build and install
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install .
35+
- name: Get package version
36+
run: python setup.py --version

0 commit comments

Comments
 (0)