feat(recipes): Ensure full compatibility with Python 3.10 #1925
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: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Unit tests | |
strategy: | |
matrix: | |
python-version: ['3.7', '3.10'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: install radiance | |
run: | | |
wget https://ladybug-tools-releases.nyc3.digitaloceanspaces.com/Radiance_5.3a.fc2a2610_Linux.zip | |
unzip Radiance_5.3a.fc2a2610_Linux.zip | |
tar -xzvf radiance-5.3.fc2a261076-Linux.tar.gz | |
sudo cp -r radiance-5.3.fc2a261076-Linux/usr/local/radiance/bin/* /usr/local/bin | |
sudo mkdir /usr/local/lib/ray | |
sudo cp -r radiance-5.3.fc2a261076-Linux/usr/local/radiance/lib/* /usr/local/lib/ray | |
- name: install openstudio | |
run: | | |
wget https://github.com/NREL/OpenStudio/releases/download/v3.2.0/OpenStudio-3.2.0+e11f0a08b2-Ubuntu-20.04.deb | |
sudo dpkg -i ./OpenStudio-3.2.0+e11f0a08b2-Ubuntu-20.04.deb | |
- name: install honeybee-openstudio-gem | |
run: | | |
mkdir -p ~/ladybug_tools/resources/measures/honeybee_openstudio_gem | |
curl -SL -o honeybee-openstudio-gem.tar.gz https://github.com/ladybug-tools/honeybee-openstudio-gem/archive/v$HONEYBEE_OPENSTUDIO_GEM_VERSION.tar.gz | |
tar -zxvf honeybee-openstudio-gem.tar.gz | |
mv honeybee-openstudio-gem-$HONEYBEE_OPENSTUDIO_GEM_VERSION/lib ~/ladybug_tools/resources/measures/honeybee_openstudio_gem | |
rm -r honeybee-openstudio-gem-$HONEYBEE_OPENSTUDIO_GEM_VERSION | |
rm honeybee-openstudio-gem.tar.gz | |
env: | |
HONEYBEE_OPENSTUDIO_GEM_VERSION: '2.17.0' | |
- name: install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install -r dev-requirements.txt | |
- name: run tests | |
run: python -m pytest tests/ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RAYPATH: /usr/local/lib/ray | |
deploy: | |
name: Deploy to GitHub and PyPI | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/master' && github.repository_owner == 'ladybug-tools' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: set up node # we need node for for semantic release | |
uses: actions/setup-node@v2.1.2 | |
with: | |
node-version: 14.17.0 | |
- name: install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r dev-requirements.txt | |
- name: install semantic-release | |
run: | |
npm install @semantic-release/exec | |
- name: run semantic release | |
id: new_release | |
run: | | |
nextRelease="`npx semantic-release@^17.0.0 --dryRun | grep -oP 'Published release \K.*? ' || true`" | |
npx semantic-release@^17.0.0 | |
echo "::set-output name=tag::$nextRelease" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
- name: Update lbt-grasshopper | |
if: contains(steps.new_release.outputs.tag, '.') | |
env: | |
DISPATCH_REPO: ladybug-tools/lbt-grasshopper | |
DEPS_TOKEN: ${{ secrets.DEPS_UPDATING }} | |
run: | | |
curl -X POST https://api.github.com/repos/$DISPATCH_REPO/dispatches \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
-d '{"event_type": "lbt_recipes_release", "client_payload": {"version": "${{ steps.new_release.outputs.tag }}"}}' \ | |
-u ladybugbot:$DEPS_TOKEN | |
docs: | |
name: Generate docs | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/master' && github.repository_owner == 'ladybug-tools' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: install dependencies | |
run: | | |
pip install -U . | |
pip install -r dev-requirements.txt | |
sphinx-apidoc -f -e -d 4 -o ./docs ./lbt_recipes | |
sphinx-build -b html ./docs ./docs/_build/docs | |
- name: deploy to github pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
# this will use ladybugbot token | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: docs/_build/ | |
force_orphan: true | |
keep_files: false | |
full_commit_message: 'deploy: update docs' |