Skip to content

Commit f5c3b0b

Browse files
authored
🔖 v1.8.7 to conincide with FCP-INDI/C-PAC#2100 (#76)
2 parents 584402b + 826d03b commit f5c3b0b

32 files changed

+2231
-911
lines changed

.coveragerc

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (C) 2023-2024 C-PAC Developers
2+
3+
# This file is modified from a file that is part of C-PAC.
4+
5+
# C-PAC is free software: you can redistribute it and/or modify it under
6+
# the terms of the GNU Lesser General Public License as published by the
7+
# Free Software Foundation, either version 3 of the License, or (at your
8+
# option) any later version.
9+
10+
# C-PAC is distributed in the hope that it will be useful, but WITHOUT
11+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13+
# License for more details.
14+
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
17+
FROM ghcr.io/fcp-indi/c-pac/ubuntu:jammy-non-free as src
18+
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A DRY-RUN TESTING IMAGE \
19+
Dry-run C-PAC latest API."
20+
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/cpac
21+
USER root
22+
COPY --from=fcpindi/c-pac:latest /code /code
23+
RUN mkdir -p /home/user/c-pac_user \
24+
&& chown -R c-pac_user:c-pac /home/user/c-pac_user \
25+
&& chown -R c-pac_user:c-pac /code \
26+
&& apt-get update && apt-get install -y \
27+
git \
28+
python3-pip \
29+
python3.10 \
30+
python-is-python3 \
31+
&& rm -rf /var/lib/apt/lists/*
32+
ENV PYTHONUSERBASE=/home/c-pac_user/.local
33+
ENV PATH=$PATH:/home/c-pac_user/.local/bin \
34+
PYTHONPATH=$PYTHONPATH:$PYTHONUSERBASE/lib/python3.10/site-packages
35+
USER c-pac_user
36+
RUN pip install -r /code/requirements.txt && pip install -e /code
37+
ENV FSLDIR="/FSLDIR"
38+
ENTRYPOINT [ "/code/run.py" ]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (C) 2023-2024 C-PAC Developers
2+
3+
# This file is modified from a file that is part of C-PAC.
4+
5+
# C-PAC is free software: you can redistribute it and/or modify it under
6+
# the terms of the GNU Lesser General Public License as published by the
7+
# Free Software Foundation, either version 3 of the License, or (at your
8+
# option) any later version.
9+
10+
# C-PAC is distributed in the hope that it will be useful, but WITHOUT
11+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13+
# License for more details.
14+
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
17+
FROM ghcr.io/fcp-indi/c-pac/ubuntu:jammy-non-free as src
18+
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A DRY-RUN TESTING IMAGE \
19+
Dry-run C-PAC nightly API."
20+
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/cpac
21+
USER root
22+
COPY --from=fcpindi/c-pac:nightly /code /code
23+
RUN mkdir -p /home/user/c-pac_user \
24+
&& chown -R c-pac_user:c-pac /home/user/c-pac_user \
25+
&& chown -R c-pac_user:c-pac /code \
26+
&& apt-get update && apt-get install -y \
27+
git \
28+
python3-pip \
29+
python3.10 \
30+
python-is-python3 \
31+
&& rm -rf /var/lib/apt/lists/*
32+
ENV PYTHONUSERBASE=/home/c-pac_user/.local
33+
ENV PATH=$PATH:/home/c-pac_user/.local/bin \
34+
PYTHONPATH=$PYTHONPATH:$PYTHONUSERBASE/lib/python3.10/site-packages
35+
USER c-pac_user
36+
RUN pip install -r /code/requirements.txt && pip install -e /code
37+
ENV FSLDIR="/FSLDIR"
38+
ENTRYPOINT [ "/code/run.py" ]

.github/workflows/pythonpublish.yml renamed to .github/workflows/pythonpublish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
1+
# This workflow will upload a Python Package using Twine when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
33

44
name: Upload Python Package

.github/workflows/test_cpac.yaml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# This workflow will test cpac
2+
3+
name: Test cpac
4+
5+
on:
6+
push:
7+
paths-ignore:
8+
- README.rst
9+
10+
jobs:
11+
set_docker_image:
12+
outputs:
13+
docker_image: ${{ steps.set_docker_image.outputs.docker_image }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- id: set_docker_image
17+
name: set tag name
18+
run: |
19+
DOCKER_IMAGE="ghcr.io/${{ github.repository }}/api-test"
20+
DOCKER_IMAGE="${DOCKER_IMAGE@L}"
21+
echo "docker_image=${DOCKER_IMAGE}" >> "${GITHUB_OUTPUT}"
22+
23+
build_dry_run_image:
24+
needs: set_docker_image
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Set up Docker Buildx
28+
uses: docker/[email protected]
29+
- name: Log in to GitHub Container Registry
30+
uses: docker/[email protected]
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
- name: Build and push
39+
uses: docker/[email protected]
40+
with:
41+
context: .
42+
file: ./.github/Dockerfiles/c-pac_api.${{ matrix.tag }}.Dockerfile
43+
provenance: false
44+
sbom: false
45+
push: true
46+
tags: |
47+
${{ needs.set_docker_image.outputs.docker_image }}:${{ matrix.tag }}
48+
strategy:
49+
matrix:
50+
tag: [latest, nightly]
51+
52+
test_cpac:
53+
env:
54+
APPTAINER_CACHEDIR: ${{ github.workspace }}/.apptainer/cache
55+
APPTAINER_TMPDIR: ${{ github.workspace }}/.apptainer/tmp
56+
needs:
57+
- build_dry_run_image
58+
- set_docker_image
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
apptainer: [1.0.0, 1.3.0]
63+
go: [1.14]
64+
platform: [apptainer, docker]
65+
python: ['3.10', 3.11, 3.12]
66+
tag: [latest, nightly]
67+
exclude:
68+
- platform: apptainer
69+
python: 3.11
70+
- platform: apptainer
71+
python: 3.12
72+
steps:
73+
- name: Clear up some space on runner
74+
run: |
75+
sudo rm -rf /usr/share/dotnet
76+
sudo rm -rf /opt/ghc
77+
sudo rm -rf "/usr/local/share/boost"
78+
- uses: actions/checkout@v4
79+
- name: Set up Go
80+
uses: actions/setup-go@v5
81+
with:
82+
cache: false
83+
go-version: ${{ matrix.go }}
84+
- name: Set up Python
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: ${{ matrix.python }}
88+
- name: Install --upgrade pip setuptools wheel
89+
run: python -m pip install --upgrade pip setuptools wheel
90+
- name: Setup apptainer
91+
if: ${{ matrix.platform == 'apptainer' }}
92+
uses: eWaterCycle/setup-apptainer@v2
93+
with:
94+
apptainer-version: ${{ matrix.apptainer }}
95+
- name: Install cpac
96+
run: cd $GITHUB_WORKSPACE && pip install -e ".[dev,testing,tsconcat]"
97+
- name: Pull images
98+
if: ${{ matrix.platform == 'apptainer' }}
99+
run: |
100+
mkdir -p ${{ env.APPTAINER_CACHEDIR }}
101+
mkdir -p ${{ env.APPTAINER_TMPDIR }}
102+
export APPTAINER_CACHEDIR=${{ env.APPTAINER_CACHEDIR }}
103+
export SINGULARITY_CACHEDIR=${{ env.APPTAINER_CACHEDIR }}
104+
export APPTAINER_TMPDIR=${{ env.APPTAINER_TMPDIR }}
105+
export SINGULARITY_TMPDIR=${{ env.APPTAINER_TMPDIR }}
106+
cpac --platform ${{ matrix.platform }} pull --image ${{ needs.set_docker_image.outputs.docker_image }} --tag ${{ matrix.tag }}
107+
- name: Test cpac, platform and tag specified
108+
run: |
109+
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --platform ${{ matrix.platform }} --tag ${{ matrix.tag }} .
110+
coverage report -m
111+
- name: Test cpac, platform specified, tag unspecified
112+
if: ${{ matrix.tag == 'latest' }} and ${{ matrix.platform == 'docker' }}
113+
run: |
114+
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --platform ${{ matrix.platform }} .
115+
coverage report -m
116+
- name: Test cpac, platform unspecified, tag specified
117+
if: ${{ matrix.platform == 'docker' }}
118+
run: |
119+
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --tag ${{ matrix.tag }} .
120+
coverage report -m
121+
- name: Test cpac, platform and tag unspecified
122+
if: ${{ matrix.platform == 'docker' }} && ${{ matrix.tag }} == 'latest'
123+
run: |
124+
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} .
125+
coverage report -m
126+
- name: Report coverage
127+
uses: AndreMiras/coveralls-python-action@v20201129
128+
with:
129+
parallel: true
130+
flag-name: Test cpac ${{ matrix.platform }} with Python ${{ matrix.python }}
131+
continue-on-error: true
132+
finalize_coverage-report:
133+
needs:
134+
- test_cpac
135+
runs-on: ubuntu-latest
136+
steps:
137+
- name: Finalize coverage report
138+
uses: AndreMiras/coveralls-python-action@v20201129
139+
with:
140+
parallel-finished: true
141+
continue-on-error: true
142+
update_README:
143+
# Only update README if tests succeed
144+
needs:
145+
- test_cpac
146+
runs-on: ubuntu-latest
147+
steps:
148+
- uses: actions/checkout@v4
149+
with:
150+
fetch-depth: 0
151+
- name: Install cpac
152+
run: |
153+
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
154+
cd $GITHUB_WORKSPACE
155+
pip install .
156+
- name: Configure Git credentials
157+
uses: oleksiyrudenko/[email protected]
158+
with:
159+
global: true
160+
token: ${{ secrets.GITHUB_TOKEN }}
161+
- name: Update README
162+
run: |
163+
(head -n $(read -d : <<< $(less README.rst | grep ".. BEGIN USAGE" -n); expr $REPLY + 1) README.rst; \
164+
printf ".. code-block:: shell\n\n cpac --help\n"; \
165+
cpac --help | sed 's/^/ /'; \
166+
tail --lines=+$(read -d : <<< $(less README.rst | grep ".. END USAGE" -n); expr $REPLY - 1) README.rst\
167+
) > tempREADME &&
168+
mv tempREADME README.rst &
169+
wait %1
170+
if [[ $(git diff --numstat README.rst) ]]; then
171+
git add README.rst
172+
git commit -m ":memo: Update usage from helpstring"
173+
git push origin HEAD:${GITHUB_REF}
174+
fi
175+
shell: bash

0 commit comments

Comments
 (0)