-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (114 loc) · 3.78 KB
/
build.yml
File metadata and controls
133 lines (114 loc) · 3.78 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
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
name: Build and Test
on:
workflow_call:
inputs:
python-version:
required: true
type: string
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
auto-update-conda: true
- name: Patch required Python version
run: |
sed -i "s|python .\+|python ==${{ inputs.python-version }}|g" environment.yml
cat environment.yml
- name: Create and validate conda environment
shell: bash
run: |
conda env create -f environment.yml --prefix ./.env
eval "$(conda shell.bash hook)"
conda activate ./.env
python -V
python -c "import sys; v = sys.version_info; assert f'{v.major}.{v.minor}' == '${{ inputs.python-version }}'"
- name: Extract libcarna version
id: meta
shell: bash
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
export libcarna_version=$(conda list --json |jq -rj '[ .[] | select( .name == "libcarna" ) ][0].version')
echo "libcarna_version=$libcarna_version" >> "$GITHUB_OUTPUT"
- name: Build dist
shell: bash
run: ./linux_build.bash
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: dist-${{ inputs.python-version }}
path: |
dist
outputs:
libcarna_version: ${{ steps.meta.outputs.libcarna_version }}
test:
needs: build
name: Test
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq libegl1
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-${{ inputs.python-version }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
auto-update-conda: true
- name: Create and validate conda environment
shell: bash
run: |
conda create --prefix ./.env -c conda-forge -c bioconda \
python==${{ inputs.python-version }} \
libcarna==${{ needs.build.outputs.libcarna_version }} \
pip
eval "$(conda shell.bash hook)"
conda activate ./.env
python -V
python -c "import sys; v = sys.version_info; assert f'{v.major}.{v.minor}' == '${{ inputs.python-version }}'"
- name: Install wheel
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
pip install libcarna_python-*.whl
- name: Test installation
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
python -c "import libcarna; assert libcarna.libcarna_version == '${{ needs.build.outputs.libcarna_version }}'"
- name: Install dependencies for tests and examples
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
pip install -r test/requirements.txt
pip install -r docs/requirements.txt
- name: Run tests
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
cd test
mkdir test
mv results test/results
python -m unittest -vv
env:
LIBCARNA_PYTHON_LOGGING: true
- name: Upload failed test output
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-output-${{ inputs.python-version }}
path: |
test/test/results/actual