Skip to content

Corrections to allow the dynamic importing of the ecoinvent biosphere… #469

Corrections to allow the dynamic importing of the ecoinvent biosphere…

Corrections to allow the dynamic importing of the ecoinvent biosphere… #469

Workflow file for this run

name: tests and development release
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
patch-test-environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Patch test environment dependencies
# This step adds the run requirements from the stable recipe to the test environment
uses: mikefarah/yq@master
with:
cmd: |
yq eval-all 'select(fi == 0).dependencies += select(fi == 1).requirements.run | select(fi == 0)' ci/conda-envs/test.yml ci/recipe/stable/meta.yaml > patched-environment.yml
- name: Show patched environment
run: cat patched-environment.yml
- name: Upload patched environment as artifact
uses: actions/upload-artifact@v2
with:
name: patched-environment
path: patched-environment.yml
tests:
runs-on: ${{ matrix.os }}
needs: patch-test-environment
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9']
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Download patched test environment
uses: actions/download-artifact@v2
with:
name: patched-environment
- name: Setup python ${{ matrix.python-version }} conda environment
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: test
environment-file: patched-environment.yml
- name: Environment info
run: |
conda list
conda env export
conda env export -f env.yaml
- name: Upload final environment as artifact
uses: actions/upload-artifact@v2
with:
name: env-${{ matrix.os }}-${{ matrix.python-version }}
path: env.yaml
- name: Install linux dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions
run: |
sudo apt install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 \
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 \
libxcb-xfixes0 xvfb x11-utils glibc-tools;
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 \
1920x1200x24 -ac +extension GLX +render -noreset;
- name: Install coveralls and coverage
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
conda install -q -y coveralls=3.3.1 coverage pytest-cov
- name: Run linux tests
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
QT_DEBUG_PLUGINS: 1
run: |
catchsegv xvfb-run --auto-servernum pytest --cov=activity_browser --cov-report=;
- name: Run tests
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
pytest
- name: Upload coverage
if: ${{ matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' }}
# https://github.com/lemurheavy/coveralls-public/issues/1435#issuecomment-763357004
# https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
# https://github.com/TheKevJames/coveralls-python/issues/252
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coveralls
deploy-development:
# Make sure to only run a deploy if all tests pass.
needs:
- tests
# And only on a push event, not a pull_request.
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
PKG_NAME: "activity-browser-dev"
steps:
- uses: actions/checkout@v2
- name: Build and deploy 3.8
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
activate-environment: build
environment-file: ci/conda-envs/build.yml
- name: Export version
run: |
echo "VERSION=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
- name: Patch recipe with run requirements from stable
uses: mikefarah/yq@master
# Adds the run dependencies from the stable recipe to the dev recipe (inplace)
# Also adds the dependecies to the ab_dev environment file
with:
cmd: |
yq eval-all -i 'select(fi == 0).requirements.run += select(fi == 1).requirements.run | select(fi == 0)' ci/recipe/dev/meta.yaml ci/recipe/stable/meta.yaml
yq eval-all -i 'select(fi == 0).dependencies += select(fi == 1).requirements.run | select(fi == 0)' ci/conda-envs/ab_dev.yml ci/recipe/stable/meta.yaml
- name: Show patched dev recipe
run: cat ci/recipe/dev/meta.yaml
- name: Build development package
run: |
conda build ci/recipe/dev
- name: Upload the activity-browser-dev package and env
run: |
anaconda -t ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --force \
/usr/share/miniconda/envs/build/conda-bld/noarch/*.tar.bz2
anaconda -t ${{ secrets.CONDA_UPLOAD_TOKEN }} upload ci/conda-envs/ab_dev.yml
deploy-arm:
# Make sure to only run a deploy if all tests pass.
needs:
- tests
# And only on a push event, not a pull_request.
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
PKG_NAME: "activity-browser-arm"
steps:
- uses: actions/checkout@v2
- name: Build and deploy 3.8
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
activate-environment: build
environment-file: ci/conda-envs/build.yml
- name: Export version
run: |
echo "VERSION=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
- name: Patch recipe with run requirements from stable
uses: mikefarah/yq@master
# Adds the run dependencies from the stable recipe to the arm recipe
# drop brightway2, but add brightway2_nosolver and scikit-umfpack
# Also adds the dependecies to the ab_arm environment file
with:
cmd: |
yq e '.requirements.run.[] | select(. != "brightway2*") | [.]' ci/recipe/stable/meta.yaml > arm_requirements.yaml
yq e -i '. += ["brightway2_nosolver", "scikit-umfpack"]' arm_requirements.yaml
yq eval-all -i 'select(fi == 0).requirements.run += select(fi == 1) | select(fi == 0)' ci/recipe/arm/meta.yaml arm_requirements.yaml
yq eval-all -i 'select(fi == 0).dependencies += select(fi == 1) | select(fi == 0)' ci/conda-envs/ab_arm.yml arm_requirements.yaml
- name: Show patched arm recipe
run: cat ci/recipe/arm/meta.yaml
- name: Build development package
run: |
conda build ci/recipe/arm
- name: Upload the activity-browser-arm package and env
run: |
anaconda -t ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --force \
/usr/share/miniconda/envs/build/conda-bld/noarch/*.tar.bz2
anaconda -t ${{ secrets.CONDA_UPLOAD_TOKEN }} upload ci/conda-envs/ab_arm.yml