V1.1.50.dev (#134) #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test ✔️ and document 📄 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Test ✔️ | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- name: Install micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
init-shell: bash | |
generate-run-shell: true | |
- name: Set up dependencies | |
run: | | |
poetry install --without dev,doc --no-root | |
shell: micromamba-shell {0} | |
- name: Install Adelie | |
run: pip install -e . | |
shell: micromamba-shell {0} | |
- name: Move Mosek license | |
run: | | |
mkdir -p $HOME/mosek | |
cp docs/mosek/mosek.lic $HOME/mosek | |
- name: Run tests | |
run: python3 -m pytest tests | |
shell: micromamba-shell {0} | |
doc: | |
name: Document 📄 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for pushing to gh-pages | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v3 | |
- name: Install micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
init-shell: bash | |
generate-run-shell: true | |
- name: Set up dependencies | |
run: | | |
poetry install --without test,dev --no-root | |
shell: micromamba-shell {0} | |
- name: Install Adelie | |
run: pip install -e . | |
shell: micromamba-shell {0} | |
- name: Install pandoc | |
run: | | |
sudo wget https://github.com/jgm/pandoc/releases/download/3.1.8/pandoc-3.1.8-1-amd64.deb -O /tmp/pandoc-3.1.8-1-amd64.deb | |
sudo dpkg -i /tmp/pandoc-3.1.8-1-amd64.deb | |
- name: Build documentation | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git fetch --all | |
git checkout gh-pages | |
git merge main -Xtheirs --allow-unrelated-histories # keeps main changes over gh-pages | |
cd docs | |
rm -rf _images _sources _static .doctrees generated notebooks *.html *.inv *.js .buildinfo | |
cd sphinx | |
make clean && make html | |
cp -r _build/html/* .. | |
touch .nojekyll | |
shell: micromamba-shell {0} | |
- name: Commit documentation changes | |
run: | | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: docs | |
github_token: ${{ secrets.GITHUB_TOKEN }} |