Skip to content

Commit 9f03851

Browse files
authored
Merge pull request #15 from openscm/update-test-pypi-install
Update test PyPI
2 parents 2412e66 + 424fccf commit 9f03851

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

.github/workflows/install-pypi.yaml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,75 @@ on:
1717

1818
jobs:
1919
test-pypi-install:
20-
name: Test PyPI install ${{ matrix.install-target }} (${{ matrix.python-version }}, ${{ matrix.os }})
20+
name: Test PyPI install ${{ matrix.install-target }} ${{ matrix.pip-install-flags }} (${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.compiler }}-${{ matrix.compiler-version }})
21+
runs-on: "${{ matrix.os }}"
2122
strategy:
2223
fail-fast: false
2324
matrix:
24-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
25+
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
2526
# Test against all security and bugfix versions: https://devguide.python.org/versions/
2627
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
2728
# Check both 'library' install and the 'application' (i.e. locked) install
28-
install-target: ["example-fgen-basic", "example-fgen-basic[locked]"]
29-
runs-on: "${{ matrix.os }}"
29+
install-target: [ "example-fgen-basic", "example-fgen-basic[locked]" ]
30+
pip-install-flags: [ "--only-binary example-fgen-basic" ]
31+
toolchain: [ "no-toolchain" ]
32+
compiler: [ "no-compiler-needed" ]
33+
compiler-version: [ "na" ]
34+
include:
35+
# Source installs on all OS for a stable Python version
36+
# (no need to do more than the combinations below)
37+
# (duplicated the config as I can't see how to write this more succintly
38+
# using gitlab's matrix logic)
39+
- os: "ubuntu-latest"
40+
python-version: "3.11"
41+
install-target: "example-fgen-basic"
42+
pip-install-flags: "--no-binary example-fgen-basic"
43+
# TODO: consider adding other compilers
44+
# (see https://github.com/fortran-lang/setup-fortran)
45+
compiler: "gcc"
46+
compiler-version: "13"
47+
- os: "macos-latest"
48+
python-version: "3.11"
49+
install-target: "example-fgen-basic"
50+
pip-install-flags: "--no-binary example-fgen-basic"
51+
# TODO: consider adding other compilers
52+
# (see https://github.com/fortran-lang/setup-fortran)
53+
compiler: "gcc"
54+
compiler-version: "13"
55+
- os: "windows-latest"
56+
python-version: "3.11"
57+
install-target: "example-fgen-basic"
58+
pip-install-flags: "--no-binary example-fgen-basic"
59+
# TODO: consider adding other compilers
60+
# (see https://github.com/fortran-lang/setup-fortran)
61+
compiler: "gcc"
62+
compiler-version: "13"
63+
3064
steps:
3165
- name: Set up Python "${{ matrix.python-version }}"
3266
id: setup-python
3367
uses: actions/setup-python@v4
3468
with:
3569
python-version: "${{ matrix.python-version }}"
70+
- name: Install Fortran compiler
71+
# When building from source, ensure we have a Fortran compiler
72+
if: matrix.pip-install-flags == '--no-binary example-fgen-basic'
73+
uses: fortran-lang/setup-fortran@v1
74+
id: setup-fortran
75+
with:
76+
compiler: ${{ matrix.compiler }}
77+
version: ${{ matrix.compiler-version }}
3678
- name: Install
3779
run: |
3880
pip install --upgrade pip wheel
39-
pip install "${{ matrix.install-target }}" 2>stderr.txt
81+
pip install "${{ matrix.install-target }}" ${{ matrix.pip-install-flags }}
4082
- name: Check no warnings
4183
if: matrix.os != 'windows-latest'
4284
run: |
85+
# Install and save stderr to file so we can check for missing target errors
86+
# (re-install is a bit stupid,
87+
# but it doesn't actually do anything except emit the warning in practice)
88+
pip install "${{ matrix.install-target }}" 2>stderr.txt
4389
if grep -q "WARN" stderr.txt; then echo "Warnings in pip install output" && cat stderr.txt && exit 1; else exit 0; fi
4490
- name: Get version non-windows
4591
if: matrix.os != 'windows-latest'

changelog/15.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated tests of installation from PyPI to handle the fact that this is a compiled package. Tests now test installation both from binary (i.e. wheel) and source (but only for Python 3.11).

0 commit comments

Comments
 (0)