Skip to content

Commit 10f0431

Browse files
committed
Push images for PRs, fix test runs in container
1 parent 5d23e39 commit 10f0431

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Diff for: .github/workflows/container.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
env:
1111
IMAGE_NAME: pynucleus
1212
IMAGE_TAGS: latest ${{ github.sha }}
13+
TEST_IMAGE_TAG: ${{ github.sha }}
1314
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
1415
REGISTRY_USER: ${{ github.actor }}
1516
REGISTRY_PASSWORD: ${{ github.token }}
@@ -21,6 +22,12 @@ jobs:
2122
timeout-minutes: 300
2223

2324
steps:
25+
- name: Change image tags for PRs
26+
if: github.event_name == 'pull_request'
27+
run: |
28+
echo "IMAGE_TAGS=pr-${{ github.event.number }}" >> $GITHUB_ENV
29+
echo "TEST_IMAGE_TAG=pr-${{ github.event.number }}" >> $GITHUB_ENV
30+
2431
- name: Check out
2532
if: always()
2633
uses: actions/checkout@v4
@@ -44,14 +51,27 @@ jobs:
4451
build-args: |
4552
PYNUCLEUS_BUILD_PARALLELISM=4
4653
54+
- name: Push To GHCR
55+
if: github.event_name == 'pull_request'
56+
uses: redhat-actions/push-to-registry@v2
57+
id: push-pr
58+
with:
59+
image: ${{ steps.build_image.outputs.image }}
60+
tags: ${{ env.IMAGE_TAGS }}
61+
registry: ${{ env.IMAGE_REGISTRY }}
62+
username: ${{ env.REGISTRY_USER }}
63+
password: ${{ env.REGISTRY_PASSWORD }}
64+
extra-args: |
65+
--disable-content-trust
66+
4767
- name: Run tests
4868
run: |
4969
podman run \
5070
-e MPIEXEC_FLAGS="--allow-run-as-root --oversubscribe" \
5171
--workdir /pynucleus \
5272
--rm \
5373
--entrypoint='["python3", "-m", "pytest", "--junit-xml", "test-results.xml"]' \
54-
${{ steps.build_image.outputs.image }}:${{ github.sha }}
74+
${{ steps.build_image.outputs.image }}:${{ env.TEST_IMAGE_TAG }}
5575
5676
- name: Push To GHCR
5777
if: github.event_name == 'push'
@@ -73,7 +93,6 @@ jobs:
7393
7494
container-test:
7595
needs: container
76-
if: github.event_name == 'push'
7796

7897
strategy:
7998
matrix:

Diff for: Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN sed -i 's/Components: main/Components: main contrib non-free/' /etc/apt/sour
1313
gcc g++ make gfortran \
1414
libssl-dev ca-certificates \
1515
git less nano \
16+
libopenblas0-serial \
1617
libmetis-dev libparmetis-dev \
1718
hdf5-tools \
1819
libsuitesparse-dev \
@@ -57,8 +58,8 @@ WORKDIR /root
5758
# Copy examples and drivers to user home, launch Jupyter notebook server
5859
ENTRYPOINT mkdir -p /root/examples && \
5960
mkdir -p /root/drivers && \
60-
cp -r --no-clobber /pynucleus/examples/* /root/examples && \
61-
cp -r --no-clobber /pynucleus/drivers/* /root/drivers && \
61+
cp -r --update=none /pynucleus/examples/* /root/examples && \
62+
cp -r --update=none /pynucleus/drivers/* /root/drivers && \
6263
jupyter notebook --port=8889 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token='' --NotebookApp.password='' --notebook-dir=/root/ --KernelSpecManager.ensure_native_kernel=False --KernelSpecManager.allowed_kernelspecs=pynucleus > /dev/null 2>&1 & \
6364
/bin/bash
6465

0 commit comments

Comments
 (0)