Skip to content

Commit

Permalink
add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
drcandacemakedamoore committed Feb 21, 2024
1 parent f5feccc commit 7666e8d
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Sanity
on: [push]

jobs:
#
SanityOnMulti:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
python-version: '3.11'
- run: python3 -m venv .venv
- run: .venv/bin/python -m pip install pycodestyle pytest nbmake
- run: .venv/bin/python ./setup.py install
- run: .venv/bin/python ./setup.py test -a "test_multi.py"
# needs to be updated to include Windows

# SanityOnWindows:
# # PB step 1 debug
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [windows-latest]
# python-version: ['3.10', '3.11']
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# - uses: s-weigand/setup-conda@v1
# with:
# conda-channels: conda-forge
# python-version: '3.11'
# - run: python3 -m venv .venv
# - run: .venv\bin\python -m pip install pycodestyle pytest nbmake
# - run: .venv\bin\python ./setup.py install
# - run: .venv\bin\python ./setup.py test -a "test_multi.py"

Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
python-version: '3.11'
- run: python3 -m venv .venv
- run: .venv/bin/python -m pip install wheel
- run: .venv/bin/python -m pip install pycodestyle pytest
- run: .venv/bin/python setup.py lint

Sphinx:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: s-weigand/setup-conda@v1
with:
conda-channels: conda-forge
python-version: '3.10'
- run: python3 -m venv .venv
- run: .venv/bin/python -m pip install wheel
- run: .venv/bin/python setup.py install
- run: .venv/bin/python -m pip install sphinx piccolo_theme
- run: .venv/bin/python setup.py apidoc
- run: .venv/bin/python setup.py build_sphinx -W
- name: Publish Docs to Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/sphinx/html

# Fair-software:
# runs-on: ubuntu-latest
# steps:
# - uses: fair-software/howfairis-github-action@0.2.1
# name: Measure compliance with fair-software.eu recommendations
# env:
# PYCHARM_HOSTED: "Trick colorama into displaying colored output"
# with:
# MY_REPO_URL: "https://github.com/${{ github.repository }}"

# Markdown:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@main
# - uses: gaurav-nelson/github-action-markdown-link-check@v1
# with:
# config-file: '.github/workflows/mlc-config.json'
88 changes: 88 additions & 0 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
push:
tags:
- v*

jobs:
PyPIBuild:
if: ${{ github.repository == 'brickstudymasons/brickstudy' }}
name: Tagged Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
# Unfortunately, wheel will try to do setup.py install to
# build a wheel... and we need this stuff to be able to build
# for CPython.

- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- run: python3.11 -m venv .venv
- run: .venv/bin/python -m pip install wheel twine
- run: .venv/bin/python setup.py bdist_wheel
- run: .venv/bin/python setup.py bdist_egg
- run: >-
TWINE_USERNAME=__token__
TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
.venv/bin/python -m twine upload --skip-existing ./dist/*.whl
- uses: actions/upload-artifact@v2
with:
name: pypi-build
path: dist/*

CondaBuild:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.11]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: s-weigand/setup-conda@v1.1.1
with:
conda-channels: conda-forge
python-version: ${{ matrix.python-version }}
- run: conda config --remove channels defaults
- name: Generate conda meta.yaml (Python 3.11)
run: python -u setup.py anaconda_gen_meta
- if: ${{ matrix.os == 'macos-latest' }}
run: python -u setup.py bdist_conda -o
- if: ${{ matrix.os != 'macos-latest' }}
run: python -u setup.py bdist_conda
- name: Upload Anaconda package
run: >-
python setup.py anaconda_upload
--token=${{ secrets.ANACONDA_TOKEN }}
--package=./dist/*/*.tar.bz2
- uses: actions/upload-artifact@v2
with:
name: conda-build-${{ matrix.os }}-${{ matrix.python-version }}
path: dist/*/*.tar.bz2

PublishArtifacts:
runs-on: ubuntu-latest
needs: [PyPIBuild, CondaBuild]
steps:
- uses: actions/download-artifact@v2
with:
path: dist
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUBTOKEN }}"
prerelease: false
files: |
./dist/*/linux-64/brickstudy-*.tar.bz2
./dist/*/osx-64/brickstudy-*.tar.bz2
./dist/*/win-64/brickstudy-*.tar.bz2
./dist/pypi-build/*.whl
./dist/pypi-build/*.egg

0 comments on commit 7666e8d

Please sign in to comment.