Skip to content

Commit

Permalink
Merge pull request #211 from mach3-software/feature_pipCI
Browse files Browse the repository at this point in the history
pip install to CI/CD
  • Loading branch information
KSkwarczynski authored Nov 9, 2024
2 parents a060615 + 1fb8ca3 commit c35d411
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 34 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/CDImage.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Update MaCh3 container image registry with newest updates
name: Image CD

Expand All @@ -24,6 +25,10 @@ jobs:
file: Doc/MaCh3DockerFiles/Alma9/Dockerfile
tag_latest: alma9latest
installoptions: -j4
- os: rocky9cuda
file: Doc/MaCh3DockerFiles/Rocky9/Dockerfile
tag_latest: rocky9cudalatest
installoptions: -j4
# - os: ubuntu22.04
# file: Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile
# tag_latest: ubuntu22.04latest
Expand All @@ -36,40 +41,40 @@ jobs:
name: Image CD ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker image
run: |
if [ "${{ github.ref_type }}" == 'tag' ]; then
docker build . \
--file ${{ matrix.file }} \
--tag ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }} \
--build-arg MACH3_VERSION=${{ github.ref_name }} \
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}"
else
docker build . \
--file ${{ matrix.file }} \
--tag ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }} \
--build-arg MACH3_VERSION=develop \
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}"
fi
- name: Build Docker image
run: |
if [ "${{ github.ref_type }}" == "tag" ]; then
docker build . \
--file "${{ matrix.file }}" \
--tag "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }}" \
--build-arg MACH3_VERSION="${{ github.ref_name }}" \
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}"
else
docker build . \
--file "${{ matrix.file }}" \
--tag "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }}" \
--build-arg MACH3_VERSION="develop" \
--build-arg INSTALL_OPTIONS="${{ matrix.installoptions }}"
fi
- name: Push Docker image
run: |
if [ "${{ github.ref_type }}" == 'tag' ]; then
docker push ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }}
else
docker push ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }}
fi
- name: Push Docker image
run: |
if [ "${{ github.ref_type }}" == "tag" ]; then
docker push "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.os }}${{ github.ref_name }}"
else
docker push "ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag_latest }}"
fi
- name: Delete old images
uses: actions/delete-package-versions@v5
with:
package-name: 'mach3'
package-type: 'container'
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'
- name: Delete old images
uses: actions/delete-package-versions@v5
with:
package-name: 'mach3'
package-type: 'container'
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'
4 changes: 4 additions & 0 deletions Doc/MaCh3DockerFiles/Alma9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ ENV MaCh3_ROOT=${MACH3_INSTALL_DIR}
ENV PATH=${MaCh3_ROOT}/bin:${PATH} \
LD_LIBRARY_PATH=${MaCh3_ROOT}/lib:${LD_LIBRARY_PATH}

# pip install pyMaCh3
WORKDIR ${MACH3_WORK_DIR}
RUN pip install .

# Start from MaCh3 install dir
WORKDIR ${MACH3_INSTALL_DIR}
4 changes: 4 additions & 0 deletions Doc/MaCh3DockerFiles/Fedora32/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,9 @@ ENV MaCh3_ROOT=${MACH3_INSTALL_DIR}
ENV PATH=${MaCh3_ROOT}/bin:${PATH} \
LD_LIBRARY_PATH=${MaCh3_ROOT}/lib:${LD_LIBRARY_PATH}

# pip install pyMaCh3
WORKDIR ${MACH3_WORK_DIR}
RUN pip install .

# Start from MaCh3 install dir
WORKDIR ${MACH3_INSTALL_DIR}
4 changes: 4 additions & 0 deletions Doc/MaCh3DockerFiles/Rocky9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,9 @@ ENV MaCh3_ROOT=${MACH3_INSTALL_DIR}
ENV PATH=${MaCh3_ROOT}/bin:${PATH} \
LD_LIBRARY_PATH=${MaCh3_ROOT}/lib:${LD_LIBRARY_PATH}

# pip install pyMaCh3
WORKDIR ${MACH3_WORK_DIR}
RUN pip install .

# Start from MaCh3 install dir
WORKDIR ${MACH3_INSTALL_DIR}
6 changes: 5 additions & 1 deletion Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt update && apt upgrade -y

RUN apt-get install -y nlohmann-json3-dev
#MISC_SW
RUN apt install -y --no-install-recommends vim less nano gdb csh tcsh ed quota python3 python3-dev cvs procmail ca-certificates
RUN apt install -y --no-install-recommends vim less nano gdb csh tcsh ed quota python3 python3-dev python3-pip cvs procmail ca-certificates

# Declare the build argument
ARG MACH3_VERSION
Expand Down Expand Up @@ -44,5 +44,9 @@ ENV MaCh3_ROOT=${MACH3_INSTALL_DIR}
ENV PATH=${MaCh3_ROOT}/bin:${PATH} \
LD_LIBRARY_PATH=${MaCh3_ROOT}/lib:${LD_LIBRARY_PATH}

# pip install pyMaCh3
WORKDIR ${MACH3_WORK_DIR}
RUN pip install .

# Start from MaCh3 install dir
WORKDIR ${MACH3_INSTALL_DIR}

0 comments on commit c35d411

Please sign in to comment.