Skip to content

Commit 5bc58c9

Browse files
Midnightercdiener
andauthored
Upgrade GitHub workflows (#1397)
* chore: upgrade GitHub workflows * chore: accept jinja2 vulnerability * docs: update readme badge * fix numpy 2 deprecation --------- Co-authored-by: Christian Diener <[email protected]>
1 parent fd1faa6 commit 5bc58c9

File tree

9 files changed

+149
-163
lines changed

9 files changed

+149
-163
lines changed

.github/workflows/cron.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Cron Test
2+
3+
on:
4+
schedule:
5+
# Run every Tuesday at 10:30.
6+
- cron: '30 10 * * 2'
7+
8+
jobs:
9+
prerequisites:
10+
uses: ./.github/workflows/test.yml
11+

.github/workflows/lint.yml

-46
This file was deleted.

.github/workflows/main.yml

+3-77
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,15 @@
1-
name: CI-CD
1+
name: CI
22

33
on:
44
push:
55
branches:
66
- stable
77
- devel
8-
tags:
9-
- "[0-9]+.[0-9]+.[0-9]+"
10-
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
118
pull_request:
129
branches:
1310
- stable
1411
- devel
1512

1613
jobs:
17-
test:
18-
runs-on: ${{ matrix.os }}
19-
strategy:
20-
fail-fast: false
21-
matrix:
22-
os: [ubuntu-latest, macos-latest, windows-latest]
23-
python-version: ["3.8", "3.11"]
24-
timeout-minutes: 360
25-
26-
steps:
27-
- uses: actions/checkout@v4
28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip setuptools wheel
35-
python -m pip install tox tox-gh-actions
36-
- name: Test with tox
37-
run: tox -- --benchmark-skip
38-
timeout-minutes: 60
39-
- name: Report coverage
40-
shell: bash
41-
run: bash <(curl -s https://codecov.io/bash)
42-
43-
release:
44-
needs: test
45-
if: github.ref_type == 'tag'
46-
runs-on: ${{ matrix.os }}
47-
strategy:
48-
matrix:
49-
os: [ubuntu-latest]
50-
python-version: ["3.11"]
51-
permissions:
52-
contents: write
53-
54-
steps:
55-
- uses: actions/checkout@v4
56-
57-
- name: Set up Python ${{ matrix.python-version }}
58-
uses: actions/setup-python@v4
59-
with:
60-
python-version: ${{ matrix.python-version }}
61-
62-
- name: Install dependencies
63-
run: |
64-
python -m pip install --upgrade pip setuptools wheel
65-
python -m pip install build twine
66-
67-
- name: Build package
68-
run: python -m build
69-
70-
- name: Publish to PyPI
71-
env:
72-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
73-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
74-
run: twine upload --skip-existing --non-interactive dist/*
75-
76-
- name: GH release
77-
uses: softprops/action-gh-release@v1
78-
with:
79-
body_path: "release-notes/${{ github.ref_name }}.md"
80-
draft: false
81-
prerelease: false
82-
83-
- name: Publish to website
84-
run: ./scripts/deploy_website.sh
85-
shell: bash
86-
env:
87-
TAG: ${{ github.ref_name }}
88-
WORKSPACE: ${{ github.workspace }}
89-
WEBSITE_DEPLOY_TOKEN: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}
14+
prerequisites:
15+
uses: ./.github/workflows/test.yml

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+(a|b|rc|post|dev)[0-9]+"
8+
9+
jobs:
10+
prerequisites:
11+
uses: ./.github/workflows/test.yml
12+
13+
release:
14+
needs: [prerequisites]
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
python-version: ["3.11"]
19+
runs-on: ${{ matrix.os }}
20+
permissions:
21+
# Write permissions are needed to create OIDC tokens.
22+
id-token: write
23+
# Write permissions are needed to make GitHub releases.
24+
contents: write
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip setuptools wheel
37+
python -m pip install build
38+
39+
- name: Build package
40+
run: python -m build
41+
42+
# We rely on a trusted publisher configuration being present on PyPI,
43+
# see https://docs.pypi.org/trusted-publishers/.
44+
- name: Publish to PyPI
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
47+
- name: GH release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
body_path: "release-notes/${{ github.ref_name }}.md"
51+
draft: false
52+
prerelease: false
53+
54+
- name: Publish to website
55+
run: ./scripts/deploy_website.sh
56+
shell: bash
57+
env:
58+
TAG: ${{ github.ref_name }}
59+
WORKSPACE: ${{ github.workspace }}
60+
WEBSITE_DEPLOY_TOKEN: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}

.github/workflows/safety.yml

-36
This file was deleted.

.github/workflows/test.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test Suite
2+
3+
on:
4+
workflow_dispatch: {}
5+
workflow_call: {}
6+
7+
jobs:
8+
lint:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest]
13+
python-version: ["3.11"]
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 60
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip setuptools wheel
28+
python -m pip install tox tox-gh-actions
29+
30+
- name: isort
31+
run: tox -e isort
32+
33+
- name: black
34+
run: tox -e black
35+
36+
- name: flake8
37+
run: tox -e flake8
38+
39+
test:
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [ubuntu-latest, macos-latest, windows-latest]
45+
python-version: ["3.8", "3.11"]
46+
timeout-minutes: 360
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
56+
- name: Install dependencies
57+
run: |
58+
python -m pip install --upgrade pip setuptools wheel
59+
python -m pip install tox tox-gh-actions
60+
61+
- name: safety
62+
run: tox -e safety
63+
64+
- name: Test with tox
65+
run: tox -- --benchmark-skip
66+
timeout-minutes: 60
67+
68+
- name: Report coverage
69+
shell: bash
70+
run: bash <(curl -s https://codecov.io/bash)
71+

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ COBRApy - Constraint-Based Reconstruction and Analysis in Python
1818
:target: https://github.com/opencobra/cobrapy/blob/devel/.github/CODE_OF_CONDUCT.md
1919
:alt: Code of Conduct
2020

21-
.. image:: https://github.com/opencobra/cobrapy/workflows/CI-CD/badge.svg
22-
:target: https://github.com/opencobra/cobrapy/workflows/CI-CD
21+
.. image:: https://github.com/opencobra/cobrapy/actions/workflows/main.yml/badge.svg
22+
:target: https://github.com/opencobra/cobrapy/actions/workflows/main.yml
2323
:alt: GitHub Actions CI/CD Status
2424

2525
.. image:: https://codecov.io/gh/opencobra/cobrapy/branch/master/graph/badge.svg

src/cobra/io/mat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ def from_mat_struct(
875875
# RECON3.0 mat has an array within an array for subsystems.
876876
# If we find a model that has multiple subsytems per reaction, this should be
877877
# modified
878-
if np.sctype2char(m["subSystems"][0, 0][0][0]) == "O" and isinstance(
878+
if m["subSystems"][0, 0][0][0].dtype.char == "O" and isinstance(
879879
m["subSystems"][0, 0][0][0][0], np.ndarray
880880
):
881881
rxn_subsystems = [

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ commands=
6363
deps=
6464
safety
6565
commands=
66-
safety check --full-report
66+
safety check --full-report -i 70612
6767

6868
[testenv:install]
6969
skip_install = True

0 commit comments

Comments
 (0)