Skip to content

Commit

Permalink
🔖 v1.8.7 to conincide with FCP-INDI/C-PAC#2100 (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy authored May 4, 2024
2 parents 584402b + 826d03b commit f5c3b0b
Show file tree
Hide file tree
Showing 32 changed files with 2,231 additions and 911 deletions.
31 changes: 0 additions & 31 deletions .coveragerc

This file was deleted.

38 changes: 38 additions & 0 deletions .github/Dockerfiles/c-pac_api.latest.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (C) 2023-2024 C-PAC Developers

# This file is modified from a file that is part of C-PAC.

# C-PAC is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.

# C-PAC is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
FROM ghcr.io/fcp-indi/c-pac/ubuntu:jammy-non-free as src
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A DRY-RUN TESTING IMAGE \
Dry-run C-PAC latest API."
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/cpac
USER root
COPY --from=fcpindi/c-pac:latest /code /code
RUN mkdir -p /home/user/c-pac_user \
&& chown -R c-pac_user:c-pac /home/user/c-pac_user \
&& chown -R c-pac_user:c-pac /code \
&& apt-get update && apt-get install -y \
git \
python3-pip \
python3.10 \
python-is-python3 \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONUSERBASE=/home/c-pac_user/.local
ENV PATH=$PATH:/home/c-pac_user/.local/bin \
PYTHONPATH=$PYTHONPATH:$PYTHONUSERBASE/lib/python3.10/site-packages
USER c-pac_user
RUN pip install -r /code/requirements.txt && pip install -e /code
ENV FSLDIR="/FSLDIR"
ENTRYPOINT [ "/code/run.py" ]
38 changes: 38 additions & 0 deletions .github/Dockerfiles/c-pac_api.nightly.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (C) 2023-2024 C-PAC Developers

# This file is modified from a file that is part of C-PAC.

# C-PAC is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.

# C-PAC is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
FROM ghcr.io/fcp-indi/c-pac/ubuntu:jammy-non-free as src
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A DRY-RUN TESTING IMAGE \
Dry-run C-PAC nightly API."
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/cpac
USER root
COPY --from=fcpindi/c-pac:nightly /code /code
RUN mkdir -p /home/user/c-pac_user \
&& chown -R c-pac_user:c-pac /home/user/c-pac_user \
&& chown -R c-pac_user:c-pac /code \
&& apt-get update && apt-get install -y \
git \
python3-pip \
python3.10 \
python-is-python3 \
&& rm -rf /var/lib/apt/lists/*
ENV PYTHONUSERBASE=/home/c-pac_user/.local
ENV PATH=$PATH:/home/c-pac_user/.local/bin \
PYTHONPATH=$PYTHONPATH:$PYTHONUSERBASE/lib/python3.10/site-packages
USER c-pac_user
RUN pip install -r /code/requirements.txt && pip install -e /code
ENV FSLDIR="/FSLDIR"
ENTRYPOINT [ "/code/run.py" ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflows will upload a Python Package using Twine when a release is created
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
Expand Down
175 changes: 175 additions & 0 deletions .github/workflows/test_cpac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# This workflow will test cpac

name: Test cpac

on:
push:
paths-ignore:
- README.rst

jobs:
set_docker_image:
outputs:
docker_image: ${{ steps.set_docker_image.outputs.docker_image }}
runs-on: ubuntu-latest
steps:
- id: set_docker_image
name: set tag name
run: |
DOCKER_IMAGE="ghcr.io/${{ github.repository }}/api-test"
DOCKER_IMAGE="${DOCKER_IMAGE@L}"
echo "docker_image=${DOCKER_IMAGE}" >> "${GITHUB_OUTPUT}"
build_dry_run_image:
needs: set_docker_image
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log in to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./.github/Dockerfiles/c-pac_api.${{ matrix.tag }}.Dockerfile
provenance: false
sbom: false
push: true
tags: |
${{ needs.set_docker_image.outputs.docker_image }}:${{ matrix.tag }}
strategy:
matrix:
tag: [latest, nightly]

test_cpac:
env:
APPTAINER_CACHEDIR: ${{ github.workspace }}/.apptainer/cache
APPTAINER_TMPDIR: ${{ github.workspace }}/.apptainer/tmp
needs:
- build_dry_run_image
- set_docker_image
runs-on: ubuntu-latest
strategy:
matrix:
apptainer: [1.0.0, 1.3.0]
go: [1.14]
platform: [apptainer, docker]
python: ['3.10', 3.11, 3.12]
tag: [latest, nightly]
exclude:
- platform: apptainer
python: 3.11
- platform: apptainer
python: 3.12
steps:
- name: Clear up some space on runner
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
cache: false
go-version: ${{ matrix.go }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install --upgrade pip setuptools wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Setup apptainer
if: ${{ matrix.platform == 'apptainer' }}
uses: eWaterCycle/setup-apptainer@v2
with:
apptainer-version: ${{ matrix.apptainer }}
- name: Install cpac
run: cd $GITHUB_WORKSPACE && pip install -e ".[dev,testing,tsconcat]"
- name: Pull images
if: ${{ matrix.platform == 'apptainer' }}
run: |
mkdir -p ${{ env.APPTAINER_CACHEDIR }}
mkdir -p ${{ env.APPTAINER_TMPDIR }}
export APPTAINER_CACHEDIR=${{ env.APPTAINER_CACHEDIR }}
export SINGULARITY_CACHEDIR=${{ env.APPTAINER_CACHEDIR }}
export APPTAINER_TMPDIR=${{ env.APPTAINER_TMPDIR }}
export SINGULARITY_TMPDIR=${{ env.APPTAINER_TMPDIR }}
cpac --platform ${{ matrix.platform }} pull --image ${{ needs.set_docker_image.outputs.docker_image }} --tag ${{ matrix.tag }}
- name: Test cpac, platform and tag specified
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --platform ${{ matrix.platform }} --tag ${{ matrix.tag }} .
coverage report -m
- name: Test cpac, platform specified, tag unspecified
if: ${{ matrix.tag == 'latest' }} and ${{ matrix.platform == 'docker' }}
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --platform ${{ matrix.platform }} .
coverage report -m
- name: Test cpac, platform unspecified, tag specified
if: ${{ matrix.platform == 'docker' }}
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} --tag ${{ matrix.tag }} .
coverage report -m
- name: Test cpac, platform and tag unspecified
if: ${{ matrix.platform == 'docker' }} && ${{ matrix.tag }} == 'latest'
run: |
coverage run --append -m pytest --basetemp=${PWD}/tmp --doctest-modules --image=${{ needs.set_docker_image.outputs.docker_image }} .
coverage report -m
- name: Report coverage
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: Test cpac ${{ matrix.platform }} with Python ${{ matrix.python }}
continue-on-error: true
finalize_coverage-report:
needs:
- test_cpac
runs-on: ubuntu-latest
steps:
- name: Finalize coverage report
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true
continue-on-error: true
update_README:
# Only update README if tests succeed
needs:
- test_cpac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install cpac
run: |
export DEB_PYTHON_INSTALL_LAYOUT=deb_system
cd $GITHUB_WORKSPACE
pip install .
- name: Configure Git credentials
uses: oleksiyrudenko/[email protected]
with:
global: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update README
run: |
(head -n $(read -d : <<< $(less README.rst | grep ".. BEGIN USAGE" -n); expr $REPLY + 1) README.rst; \
printf ".. code-block:: shell\n\n cpac --help\n"; \
cpac --help | sed 's/^/ /'; \
tail --lines=+$(read -d : <<< $(less README.rst | grep ".. END USAGE" -n); expr $REPLY - 1) README.rst\
) > tempREADME &&
mv tempREADME README.rst &
wait %1
if [[ $(git diff --numstat README.rst) ]]; then
git add README.rst
git commit -m ":memo: Update usage from helpstring"
git push origin HEAD:${GITHUB_REF}
fi
shell: bash
Loading

0 comments on commit f5c3b0b

Please sign in to comment.