diff --git a/.github/actions/setup-pyscipopt-action/action.yml b/.github/actions/setup-pyscipopt-action/action.yml new file mode 100644 index 0000000..f3298d0 --- /dev/null +++ b/.github/actions/setup-pyscipopt-action/action.yml @@ -0,0 +1,31 @@ +name: "Setup PySCIPOpt" + +inputs: + ref: + description: "PySCIPOpt ref that will be checked out" + required: true + default: "master" + +runs: + using: "composite" + steps: + - name: Checkout PySCIPOpt + uses: actions/checkout@v2 + with: + repository: scipopt/PySCIPOpt.git + ref: ${{ inputs.ref }} + path: PySCIPOpt + - run: echo "PySCIPOpt_HASH=$(cd PySCIPOpt && git rev-parse HEAD)" >> $GITHUB_ENV + shell: bash + + - name: Cache PySCIPOpt Build + uses: actions/cache@v2 + with: + path: ~/PySCIPOpt_dist + key: ${{ runner.os }}-PySCIPOpt-${{ env.PySCIPOpt_HASH }} + + - name: Build & Install PySCIPOpt + run: | + [ ! -f ~/PySCIPOpt_dist/*.whl ] && pip install wheel && python -m build --no-isolation --wheel --outdir ~/PySCIPOpt_dist/ PySCIPOpt/ + pip install ~/PySCIPOpt_dist/*.whl + shell: bash diff --git a/.github/actions/setup-scipoptsuite-action/action.yml b/.github/actions/setup-scipoptsuite-action/action.yml new file mode 100644 index 0000000..6941cd1 --- /dev/null +++ b/.github/actions/setup-scipoptsuite-action/action.yml @@ -0,0 +1,22 @@ +name: "Setup SCIPOptSuite" + +inputs: + version: + description: "SCIPOptSuite version to install" + required: true + default: "8.0.0" + +runs: + using: "composite" + steps: + - name: Cache SCIPOptSuite Package + uses: actions/cache@v2 + with: + path: ~/SCIPOptSuite-${{ inputs.version }}-Linux-ubuntu.deb + key: ${{ runner.os }}-SCIPOptSuite-${{ env.version }}-home + + - 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 + shell: bash diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml new file mode 100644 index 0000000..5060566 --- /dev/null +++ b/.github/workflows/build-package.yml @@ -0,0 +1,67 @@ +name: Build Package + +on: [push] + +jobs: + Build-Package-Linux: + runs-on: ubuntu-20.04 + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - 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 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 "noreply@or.rwth-aachen.de" + 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 diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 0000000..c715c45 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,12 @@ +name: Release Package to Test Environment + +on: + workflow_dispatch: + +jobs: + release-test: + uses: scipopt/PyGCGOpt/.github/workflows/release.yml@f2599b88caf1731cd0585a92e89b8e0d6e4670f2 + with: + production: false + secrets: + PYPI_API_TOKEN: ${{ secrets.TESTPYPI_API_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..84e4daf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Release Package + +on: + workflow_call: + inputs: + production: + type: boolean + required: true + default: false + +jobs: + Build-Package-Linux: + runs-on: ubuntu-20.04 + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - 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 + + - name: Prepare Python Environment + run: | + pip install -r requirements.txt + + - name: Setup PySCIPOpt + uses: ./.github/actions/setup-pyscipopt-action + with: + ref: scip-8 + + - name: Build PyGCGOpt + run: | + python -m build --sdist --no-isolation --outdir dist/ + + - name: Install PyGCGOpt + run: | + pip install dist/*.tar.gz + + - name: Upload PyGCGOpt dist artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/ + + Release-PyPI: + needs: [Build-Package-Linux] + runs-on: ubuntu-20.04 + steps: + - name: Download PyGCGOpt dist artifacts + uses: actions/download-artifact@v2 + with: + name: dist + + - name: "Publish to pypi.org" + if: ${{ inputs.production }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true + packages_dir: dist/ + + - name: "Publish to test.pypi.org" + if: ${{ !inputs.production }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository_url: https://test.pypi.org/legacy/ + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true + packages_dir: dist/ diff --git a/docs/requirements.txt b/docs/requirements.txt index 31749da..094887c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,6 @@ -sphinx -sphinx_copybutton -furo -myst_parser -nbsphinx -jupyter - +Sphinx==4.3.1 +sphinx_copybutton==0.4.0 +furo==2021.11.23 +myst-parser==0.15.2 +nbsphinx==0.8.7 +jupyter==1.0.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..da9396c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +build==0.7.0 +Cython==0.29.24