Skip to content

Commit 629904c

Browse files
authored
Upgrade GitHub workflows (#267)
1 parent 0443f19 commit 629904c

File tree

6 files changed

+115
-78
lines changed

6 files changed

+115
-78
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/main.yml

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

33
on:
44
push:
55
branches:
66
- master
77
- devel
8-
tags:
9-
- '[0-9]+.[0-9]+.[0-9]+'
10-
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
118
pull_request:
129
branches:
1310
- master
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-13, windows-latest]
23-
python-version: ["3.8", "3.9", "3.10", "3.11"]
24-
25-
steps:
26-
- uses: actions/checkout@v2
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v2
29-
with:
30-
python-version: ${{ matrix.python-version }}
31-
- name: Install dependencies
32-
run: |
33-
python -m pip install --upgrade pip setuptools wheel
34-
python -m pip install tox tox-gh-actions
35-
- name: Test with tox
36-
run: tox -- --cover-xml
37-
env:
38-
CI: true
39-
- name: Report coverage
40-
shell: bash
41-
run: bash <(curl -s https://codecov.io/bash)
42-
43-
release:
44-
needs: test
45-
if: startsWith(github.ref, 'refs/tags')
46-
runs-on: ${{ matrix.os }}
47-
strategy:
48-
matrix:
49-
os: [ubuntu-latest]
50-
python-version: [3.8]
51-
52-
steps:
53-
- uses: actions/checkout@v2
54-
- name: Set up Python ${{ matrix.python-version }}
55-
uses: actions/setup-python@v2
56-
with:
57-
python-version: ${{ matrix.python-version }}
58-
- name: Get tag
59-
id: tag
60-
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
61-
- name: Install dependencies
62-
run: |
63-
python -m pip install --upgrade pip setuptools wheel
64-
python -m pip install twine
65-
- name: Build package
66-
run: python setup.py sdist bdist_wheel
67-
- name: Check the package
68-
run: twine check dist/*
69-
- name: Publish to PyPI
70-
env:
71-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
72-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
73-
run:
74-
twine upload --skip-existing --non-interactive dist/*
75-
- name: Create GitHub release
76-
uses: actions/create-release@v1
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
with:
80-
tag_name: ${{ github.ref }}
81-
release_name: ${{ github.ref }}
82-
body: >
83-
Please see
84-
https://github.com/${{ github.repository }}/blob/${{ steps.tag.outputs.version }}/CHANGELOG.rst
85-
for the full release notes.
86-
draft: false
87-
prerelease: false
14+
prerequisites:
15+
uses: ./.github/workflows/test.yml

.github/workflows/release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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: >
51+
Please see
52+
https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.rst
53+
for the full release notes.
54+
draft: false
55+
prerelease: false
56+

.github/workflows/test.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test Suite
2+
3+
on:
4+
workflow_dispatch: {}
5+
workflow_call: {}
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest, macos-13, windows-latest]
14+
python-version: ["3.8", "3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip setuptools wheel
27+
python -m pip install build tox tox-gh-actions twine
28+
29+
- name: Build package
30+
run: python -m build
31+
32+
- name: Check the package distribution
33+
run: twine check dist/*
34+
35+
- name: Test with tox
36+
run: tox -- --cover-xml
37+
env:
38+
CI: true
39+
40+
- name: Report coverage
41+
shell: bash
42+
run: bash <(curl -s https://codecov.io/bash)
43+

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ Future outlook
150150
.. |Code of Conduct| image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
151151
:target: .github/CODE_OF_CONDUCT.md
152152
:alt: Code of Conduct
153-
.. |GitHub Actions| image:: https://github.com/opencobra/optlang/workflows/CI-CD/badge.svg
154-
:target: https://github.com/opencobra/optlang/workflows/CI-CD
153+
.. |GitHub Actions| image:: https://github.com/opencobra/optlang/actions/workflows/main.yml/badge.svg
154+
:target: https://github.com/opencobra/optlang/actions/workflows/main.yml
155155
:alt: GitHub Actions
156156
.. |Coverage Status| image:: https://codecov.io/gh/opencobra/optlang/branch/master/graph/badge.svg
157157
:target: https://codecov.io/gh/opencobra/optlang

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ classifiers =
1515
License :: OSI Approved :: Apache Software License
1616
Natural Language :: English
1717
Operating System :: OS Independent
18-
Programming Language :: Python :: 3.7
1918
Programming Language :: Python :: 3.8
2019
Programming Language :: Python :: 3.9
2120
Programming Language :: Python :: 3.10

0 commit comments

Comments
 (0)