Skip to content

Commit ee166de

Browse files
committed
CI: Reduce validation workflow
1 parent 5a65956 commit ee166de

File tree

1 file changed

+5
-111
lines changed

1 file changed

+5
-111
lines changed

.github/workflows/validate.yml

Lines changed: 5 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python package
1+
name: Validations
52

63
on:
74
push:
85
branches: [ '*' ]
9-
tags: [ '*' ]
106
pull_request:
11-
branches: [ master, 'maint/*' ]
7+
branches: [ master, main, 'maint/*' ]
8+
9+
env:
10+
FORCE_COLOR: true
1211

1312
concurrency:
1413
group: ${{ github.workflow }}-${{ github.ref }}
@@ -18,115 +17,10 @@ permissions:
1817
contents: read
1918

2019
jobs:
21-
job_metadata:
22-
if: github.repository == 'nipreps/sdcflows'
23-
runs-on: ubuntu-latest
24-
outputs:
25-
commit_message: ${{ steps.get_commit_message.outputs.commit_message }}
26-
version: ${{ steps.show_version.outputs.version }}
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
with:
31-
fetch-depth: 0
32-
- name: Print head git commit message
33-
id: get_commit_message
34-
run: |
35-
if [[ -z "$COMMIT_MSG" ]]; then
36-
COMMIT_MSG=$(git show -s --format=%s $REF)
37-
fi
38-
echo commit_message=$COMMIT_MSG | tee -a $GITHUB_OUTPUT
39-
env:
40-
COMMIT_MSG: ${{ github.event.head_commit.message }}
41-
REF: ${{ github.event.pull_request.head.sha }}
42-
- name: Detect version
43-
id: show_version
44-
run: |
45-
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
46-
VERSION=${GITHUB_REF##*/}
47-
else
48-
pip install -U build hatch hatchling pip twine docutils
49-
VERSION=$( python -m hatch version | tail -n1 | xargs )
50-
fi
51-
echo version=$VERSION | tee -a $GITHUB_OUTPUT
52-
53-
build:
54-
if: github.repository == 'nipreps/sdcflows'
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v4
58-
with:
59-
fetch-depth: 0
60-
- name: Set up Python 3
61-
uses: actions/setup-python@v5
62-
with:
63-
python-version: 3
64-
- name: Display Python version
65-
run: python -c "import sys; print(sys.version)"
66-
- name: Build sdcflows
67-
run: pipx run build
68-
- name: Check distributions
69-
run: pipx run twine check dist/*
70-
- uses: actions/upload-artifact@v4
71-
with:
72-
name: dist
73-
path: dist/
74-
75-
test:
76-
if: "!startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
77-
needs: [build, job_metadata]
78-
runs-on: ubuntu-latest
79-
strategy:
80-
matrix:
81-
python-version: ["3.9", "3.12"]
82-
install: [repo, sdist, wheel, editable]
83-
84-
env:
85-
INSTALL_TYPE: ${{ matrix.install }}
86-
87-
steps:
88-
- uses: actions/checkout@v4
89-
if: matrix.install == 'repo' || matrix.install == 'editable'
90-
with:
91-
fetch-depth: 0
92-
- name: Set up Python ${{ matrix.python-version }}
93-
uses: actions/setup-python@v5
94-
with:
95-
python-version: ${{ matrix.python-version }}
96-
- name: Fetch packages
97-
if: matrix.install == 'sdist' || matrix.install == 'wheel'
98-
uses: actions/download-artifact@v4
99-
with:
100-
name: dist
101-
path: dist/
102-
- name: Select archive
103-
run: |
104-
if [ "$INSTALL_TYPE" = "sdist" ]; then
105-
ARCHIVE=$( ls dist/*.tar.gz )
106-
elif [ "$INSTALL_TYPE" = "wheel" ]; then
107-
ARCHIVE=$( ls dist/*.whl )
108-
elif [ "$INSTALL_TYPE" = "repo" ]; then
109-
ARCHIVE="."
110-
elif [ "$INSTALL_TYPE" = "editable" ]; then
111-
ARCHIVE="-e ."
112-
fi
113-
echo "ARCHIVE=$ARCHIVE" | tee -a $GITHUB_ENV
114-
- name: Install package
115-
run: python -m pip install $ARCHIVE
116-
- name: Check version
117-
run: |
118-
INSTALLED_VERSION=$(python -c 'import sdcflows; print(sdcflows.__version__, end="")')
119-
echo "INSTALLED: \"${INSTALLED_VERSION}\""
120-
test "${INSTALLED_VERSION}" = "${VERSION}"
121-
env:
122-
VERSION: ${{ needs.job_metadata.outputs.version }}
123-
12420
flake8:
12521
runs-on: ubuntu-latest
12622
steps:
12723
- uses: actions/checkout@v4
128-
- name: Set up Python
129-
uses: actions/setup-python@v5
13024
- run: pipx run flake8-pyproject sdcflows/
13125

13226
# codespell:

0 commit comments

Comments
 (0)