Methods deletion simplification and fix #1050
Workflow file for this run
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: tests and development release | |
on: | |
pull_request: | |
branches: | |
- main | |
- minor | |
push: | |
branches: | |
- main | |
jobs: | |
patch-test-environment: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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)' .github/conda-envs/test.yml recipe/meta.yaml > patched-environment.yml | |
- name: Show patched environment | |
run: cat patched-environment.yml | |
- name: Upload patched environment as artifact | |
uses: actions/upload-artifact@v4 | |
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.10', '3.11'] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download patched test environment | |
uses: actions/download-artifact@v4 | |
with: | |
name: patched-environment | |
- name: Setup python ${{ matrix.python-version }} conda environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: '1.5.9-1' | |
environment-name: test | |
environment-file: patched-environment.yml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
- name: Environment info | |
run: | | |
micromamba list | |
micromamba env export | |
micromamba env export > env.yaml | |
- name: Upload final environment as artifact | |
uses: actions/upload-artifact@v3 | |
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: | | |
micromamba 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.11' && 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@v3 | |
with: | |
fetch-depth: "0" | |
- name: Build and deploy 3.11 | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: 3.11 | |
activate-environment: build | |
environment-file: .github/conda-envs/build.yml | |
- name: Export version | |
run: | | |
echo "VERSION=$(git describe --tags --always | cut -d- -f1,2 | sed 's/-/dev/')" >> $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) | |
with: | |
cmd: | | |
yq eval-all -i 'select(fi == 0).requirements.run += select(fi == 1).requirements.run | select(fi == 0)' .github/dev-recipe/meta.yaml recipe/meta.yaml | |
- name: Show patched dev recipe | |
run: cat .github/dev-recipe/meta.yaml | |
- name: Build development package | |
run: | | |
conda build .github/dev-recipe/ | |
- name: Upload the activity-browser-dev package | |
run: | | |
anaconda -t ${{ secrets.CONDA_UPLOAD_TOKEN }} upload \ | |
/usr/share/miniconda/envs/build/conda-bld/noarch/*.tar.bz2 |