-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.59 KB
/
python-package.yml
File metadata and controls
91 lines (78 loc) · 2.59 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: ProtPeptigram CI/CD
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest matplotlib pandas numpy biopython rich rich-argparse
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Create test data directory
run: |
mkdir -p data/test
# Create mock data for testing
echo "Sample test data" > data/test/sample.csv
- name: Copy test data from repository
run: |
if [ -d "test/data" ]; then
cp -r test/data/* data/test/
else
# Alternative: Use data from the main data directory if available
if [ -d "data" ] && [ -f "data/JCI146771_Mouse_peptides_peaks_online.csv" ]; then
cp data/JCI146771_Mouse_peptides_peaks_online.csv data/test/
cp data/uniprotkb_proteome_UP000000589_AND_revi_2025_03_12.fasta data/test/ || echo "FASTA file not found, tests may fail"
fi
fi
- name: Run tests
run: |
pytest -xvs
build-n-publish:
name: Build and publish Python distributions to PyPI
needs: test
runs-on: ubuntu-latest
# Only run this job if we're pushing a tag that starts with 'v'
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write # Required for trusted publishing
contents: read
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip_existing: true
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}