-
Notifications
You must be signed in to change notification settings - Fork 4
144 lines (123 loc) · 4.36 KB
/
build.yml
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
140
141
142
143
144
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: tests
on:
push:
branches:
- main
tags:
- "*-[0-9]+.*"
pull_request:
branches:
- main
env:
NAPARI_IMAGEJ_TEST_TIMEOUT: 60000
jobs:
test-pip:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Java 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
- name: Setup Qt libraries
uses: tlambert03/setup-qt-libs@v1
# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
# We run headless on CI. This yields issues on Mac, where running Java
# headless will alter the screen size on Python, leading to errors. Adding
# this environment variable prevents Java from modifying the screen size.
- name: Set MacOS environment variables
if: runner.os == 'MacOS'
run: |
echo "AWT_FORCE_HEADFUL=true" >> $GITHUB_ENV
- name: Install napari-imagej
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
- name: Test napari-imagej
uses: coactions/setup-xvfb@v1
with:
run:
bash bin/test.sh
ensure-clean-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.9
# This step ensures that everything is installed
- name: Install code cleaning components
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
- name: Lint code
uses: psf/black@stable
- name: Flake code
run: |
python -m flake8 src tests
- name: Check import ordering
uses: isort/isort-action@master
with:
configuration: --check-only
- name: Validate pyproject.toml
run: |
python -m validate_pyproject pyproject.toml
conda-dev-test:
name: Conda Setup & Code Coverage
runs-on: ubuntu-latest
defaults:
# Steps that rely on the activated environment must be run with this shell setup.
# See https://github.com/marketplace/actions/setup-miniconda#important
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v2
env:
# Increase this value to reset cache if dev-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('dev-environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
# Create env with dev packages
auto-update-conda: true
python-version: "3.10"
miniforge-variant: Mambaforge
environment-file: dev-environment.yml
# Activate napari-imagej-dev environment
activate-environment: napari-imagej-dev
auto-activate-base: false
# Use mamba for faster setup
use-mamba: true
- name: Setup Qt libraries
uses: tlambert03/setup-qt-libs@v1
- name: Test napari-imagej
uses: GabrielBB/xvfb-action@v1
with:
run: |
conda run -n napari-imagej-dev --no-capture-output python -m pytest -s -p no:faulthandler --color=yes --cov-report=xml --cov=.
# We could do this in its own action, but we'd have to setup the environment again.
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2