-
Notifications
You must be signed in to change notification settings - Fork 33
77 lines (72 loc) · 2.84 KB
/
python-package.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
tags: '*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build Distribution
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: Install Test Dependencies
run: |
pip install -r test-requirements.txt
python -m pip install mypy
mypy --version
- name: Type Checking
run: |
python -m pip install types-pytz types-tzlocal types-setuptools
mypy --install-types --non-interactive --namespace-packages --ignore-missing-imports --strict --exclude '/test' -p nion.swift
- name: Test
run: |
python -m unittest discover -s nion/swift -p '*_test.py'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
with:
name: distribution
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
with:
skip-existing: true
user: __token__
password: ${{ secrets.pypi_password }}
- name: Set up Miniconda for conda-build
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: '3.11'
- name: Build/publish anaconda package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
shell: bash -l {0}
run: |
# make a directory to avoid name conflicts with the channel. argh.
mkdir conda_build
pushd conda_build
conda update -n base --all -y
conda update --all -y
conda install conda-build anaconda-client -y
conda-build -q -c nion --skip-existing --user nion --token ${{ secrets.anaconda_token }} ..
popd