Skip to content

Commit

Permalink
Add GitHub Actions for publishing package and documentation (#6)
Browse files Browse the repository at this point in the history
* Add GitHub Actions job

* Fix docs requirements

* Add build requirements

* Add basic build action

* Add pandoc dependency

* Fix spelling of sudo

* Test Cache

* Ensure wget is cache

* Experiement with caching

* Move Cache to home directory

* Try home dir

* Move wget output path

* Test cache

* Add caching for PySCIPOpt

* Fix PySCIPOpt install

* Fix PySCIPOpt build path

* Test PySCIPOpt cache

* Make only one apt-get install

* Deploy docs to GitHub pages

* Fix typo in CI user email

* Allow empty commits for documentation

* Create setup-scipoptsuite.zml

* Create setup-pyscipopt.yml

* Make setup-pyscipopt an action

* Make setup-scipoptsuite action

* Use custom actions

* Checkout repository first

* Fix path

* Fix inputs

* Fix inputs again

* Add missing shell

* Use shell

* Setup scip-8 branch

* Quiet download of SCIPOptSuite

* Add release workflow

* Finish release workflow

* Create release-test.yml

* Add secret

* Update release workflow reference

* Fix paths in release

* Update release hash

* Bump version to 0.1.1

* Rename release testpypi

* Create release-production.yml

* Create deploy-documentation.yml

* Remove doc deploy from default build

* Update build-package.yml

* Update action.yml

* Update deploy-documentation.yml
  • Loading branch information
steffanschlein authored Dec 10, 2021
1 parent 97a23ba commit 35959ec
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-scipoptsuite-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ runs:
- name: Install dependencies (SCIPOptSuite)
run: |
wget --quiet --timestamping --directory-prefix=$HOME https://scipopt.org/download/release/SCIPOptSuite-${{ inputs.version }}-Linux-ubuntu.deb
sudo apt-get install -y pandoc ~/SCIPOptSuite-${{ inputs.version }}-Linux-ubuntu.deb
sudo apt-get install -y ~/SCIPOptSuite-${{ inputs.version }}-Linux-ubuntu.deb
shell: bash
37 changes: 2 additions & 35 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,16 @@ jobs:
cache: 'pip'
cache-dependency-path: |
requirements.txt
docs/requirements.txt
- name: Prepare Python Environment
run: |
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Setup PySCIPOpt
uses: ./.github/actions/setup-pyscipopt-action
with:
ref: scip-8

- name: Build PyGCGOpt
- name: Build & Install PyGCGOpt
run: |
python -m build --sdist --no-isolation --outdir dist/
- name: Install PyGCGOpt
run: |
pip install dist/*.tar.gz
- name: Build Documentation
run: make html
working-directory: ./docs

- name: Checkout Documentation Branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages

- name: Deploy Documentation
run: |
rm -rf gh-pages/*
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config user.name "GCG CI Bot"
git config user.email "[email protected]"
git add .
git commit --allow-empty -m "Deploy docs to GitHub Pages, GitHub Actions build: ${GITHUB_RUN_ID}" -m "Commit: ${GITHUB_SHA}"
git push
- name: Archive Documentation
uses: actions/upload-artifact@v2
with:
name: sphinx-documentation
path: docs/_build/html
pip install .
65 changes: 65 additions & 0 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy Documentation

on:
workflow_dispatch:

jobs:
Build-Package-Linux:
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Setup pandoc
run: |
sudo apt-get install -y pandoc
- name: Setup SCIPOptSuite
uses: ./.github/actions/setup-scipoptsuite-action

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: |
requirements.txt
docs/requirements.txt
- name: Prepare Python Environment
run: |
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Setup PySCIPOpt
uses: ./.github/actions/setup-pyscipopt-action
with:
ref: scip-8

- name: Build & Install PyGCGOpt
run: |
pip install .
- name: Build Documentation
run: make html
working-directory: ./docs

- name: Checkout Documentation Branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages

- name: Deploy Documentation
run: |
rm -rf gh-pages/*
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config user.name "GCG CI Bot"
git config user.email "[email protected]"
git add .
git commit --allow-empty -m "Deploy docs to GitHub Pages, GitHub Actions build: ${GITHUB_RUN_ID}" -m "Commit: ${GITHUB_SHA}"
git push
- name: Archive Documentation
uses: actions/upload-artifact@v2
with:
name: sphinx-documentation
path: docs/_build/html
12 changes: 12 additions & 0 deletions .github/workflows/release-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release Package PyPI

on:
workflow_dispatch:

jobs:
release-test:
uses: scipopt/PyGCGOpt/.github/workflows/release.yml@b726a0019e1fb2c27765266adb4d700130e35679
with:
production: true
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Release Package to Test Environment
name: Release Package TestPyPI

on:
workflow_dispatch:

jobs:
release-test:
uses: scipopt/PyGCGOpt/.github/workflows/release.yml@f2599b88caf1731cd0585a92e89b8e0d6e4670f2
uses: scipopt/PyGCGOpt/.github/workflows/release.yml@b726a0019e1fb2c27765266adb4d700130e35679
with:
production: false
secrets:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
type: boolean
required: true
default: false
secrets:
PYPI_API_TOKEN:
required: true

jobs:
Build-Package-Linux:
Expand Down Expand Up @@ -46,7 +49,7 @@ jobs:
- name: Upload PyGCGOpt dist artifacts
uses: actions/upload-artifact@v2
with:
name: dist
name: PyGCGOpt-source-distribution
path: dist/

Release-PyPI:
Expand All @@ -56,7 +59,8 @@ jobs:
- name: Download PyGCGOpt dist artifacts
uses: actions/download-artifact@v2
with:
name: dist
name: PyGCGOpt-source-distribution
path: dist/

- name: "Publish to pypi.org"
if: ${{ inputs.production }}
Expand Down
2 changes: 1 addition & 1 deletion src/pygcgopt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.1.0'
__version__ = '0.1.1'

# required for Python 3.8 on Windows
import os
Expand Down

0 comments on commit 35959ec

Please sign in to comment.