Skip to content

Commit

Permalink
GitHub Actions (#50)
Browse files Browse the repository at this point in the history
* github actions

* removed whitespace in src name

* pyproject.toml field spelling

* removed randomly-dont-reorganize

* tmi -> alpineer

* added in tox.ini for pycodestyle

* removed unused import in setup.py
  • Loading branch information
srivarra authored Mar 14, 2023
1 parent ebe26d7 commit c9f7aa0
Show file tree
Hide file tree
Showing 24 changed files with 378 additions and 299 deletions.
15 changes: 0 additions & 15 deletions .coveragerc

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Wheel Builder

on:
workflow_call:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build_wheels:
name: Build ${{ github.repository }} wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12]

steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU (For Linux ARM)
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build Wheels
uses: pypa/[email protected]
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"

- name: Store Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: distributions
path: wheelhouse/*.whl

build_sdist:
name: Build ${{ github.repository }} Source Distribution
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- name: Check sdist Metadata
run: pipx run twine check dist/*

- name: Store sdist Artifacts
uses: actions/upload-artifact@v3
with:
name: distributions
path: dist/*.tar.gz
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
types: [labeled, opened, synchronize, reopened]
workflow_dispatch:
merge_group:
types: [checks_requested]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
test:
name: Test
permissions:
contents: read
pull-requests: write
secrets: inherit
uses: ./.github/workflows/test.yml

build:
name: Build
permissions:
contents: read
pull-requests: write
secrets: inherit
uses: ./.github/workflows/build.yml

upload_coverage:
needs: [test]
name: Upload Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout ${{github.repository }}
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Coverage Artifact
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage

- name: Upload Coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ github.workspace }}/coverage/coverage.lcov
71 changes: 71 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build Wheels and upload to PyPI

on:
pull_request:
branches: ["releases/**"]
types: [labeled, opened, synchronize, reopened]
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
test:
name: Test
permissions:
contents: read
secrets: inherit
uses: ./.github/workflows/test.yml

build_wheels_sdist:
needs: [test]
name: Build
uses: ./.github/workflows/build.yml
secrets: inherit

test_pypi_publish:
# Test PyPI publish, requires wheels and source dist (sdist)
name: Publish ${{ github.repository }} to TestPyPI
needs: [test, build_wheels_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: distributions
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1.6
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: dist/
verbose: true

pypi_publish:
name: Publish ${{ github.repository }} to to PyPI
needs: [test, build_wheels_sdist, test_pypi_publish]

runs-on: ubuntu-latest
# Publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: distributions
path: dist

- name: PYPI Publish
uses: pypa/gh-action-pypi-publish@release/v1.6
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/
verbose: true
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test

on:
workflow_call:

permissions:
contents: read # to fetch code (actions/checkout)
jobs:
test:
name: Test ${{ github.repository }}
runs-on: ubuntu-latest

steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache-dependency-path: "**/pyproject.toml"
cache: "pip"

- name: Install Dependencies and ${{ github.repository }}
run: |
pip install .[test]
- name: Run Tests
run: |
pytest
- name: Archive Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: |
coverage.lcov
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ mibi_bin_tools/*.so
*.egg-info
.coverage
htmlcov/
.DS_Store
.DS_Store
.venv
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions docker-requirements.txt

This file was deleted.

Loading

0 comments on commit c9f7aa0

Please sign in to comment.