-
Notifications
You must be signed in to change notification settings - Fork 58
139 lines (136 loc) · 5.11 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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