Repository navigation
71 lines (59 loc) · 1.93 KB
/
Copy pathCI.yml
File metadata and controls
71 lines (59 loc) · 1.93 KB
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
name: CI
on:
pull_request:
branches: ["main"] # run tests on PRs
push:
tags:
- "v*" # only release on tags like v0.2.0
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Add GLMakie/XFVB dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- name: Checkout
uses: actions/checkout@v4
- name: Set up Julia
uses: julia-actions/setup-julia@v1
with:
version: "1.11" # choose your Julia version
# Set up conda using environment.yml
- name: Set up conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
environment-file: ./environment.yml
auto-activate-base: false
- name: Install package
shell: bash -l {0}
run: |
conda activate test
pip install -e .
- name: Run tests with xvfb
shell: bash -l {0}
run: |
conda activate test
xvfb-run -s "-screen 0 1024x768x24" pytest --cov=battmo --cov-report=term-missing
release:
name: Build and publish to PyPI
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v') # only run for pybattmo version tags
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload dist/*