-
Notifications
You must be signed in to change notification settings - Fork 58
137 lines (134 loc) · 5.27 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
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@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)' 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@v3
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@v3
- name: Download patched test environment
uses: actions/download-artifact@v3
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@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: |
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@v3
- 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