Skip to content

Commit

Permalink
Merge pull request #1489 from bquan0/build-test-composite
Browse files Browse the repository at this point in the history
Add composite action for BuildTest job
  • Loading branch information
gonuke committed Jul 14, 2023
2 parents 948bc2b + df359b7 commit fe0a590
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 77 deletions.
44 changes: 44 additions & 0 deletions .github/actions/build-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: BuildTest
description: Builds and tests an installation of PyNE in a single docker image. This action is used for bootstrap testing when building the docker images as well as testing of each PR using those docker images.
inputs:
stage:
description: The docker stage that will be used as the docker image for testing.
required: true
default: ''
hdf5:
description: Information about which version of HDF5 will be used for testing.
required: true
default: ''
runs:
using: "composite"
steps:
- name: setup
shell: bash -l {0}
run: |
export ADD_FLAG=" "
if [[ "${{ inputs.stage }}" == "moab" || "${{ inputs.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --moab /root/opt/moab"
fi
if [[ "${{ inputs.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --dagmc /root/opt/dagmc"
fi
if [[ "${{ inputs.hdf5 }}" == "_hdf5" ]]; then
export ADD_FLAG="${ADD_FLAG} --hdf5 /root/opt/hdf5/hdf5-1_12_0"
fi
export ADD_FLAG="${ADD_FLAG} "
echo "ADD_FLAG=${ADD_FLAG}" >> $GITHUB_ENV
- name: Building PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE
python setup.py install --user --clean ${{ env.ADD_FLAG}}
export PATH="$PATH:/github/home/.local/bin"
cd ../
nuc_data_make
- name: Testing PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/tests
./ci-run-tests.sh python3
40 changes: 7 additions & 33 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,15 @@ jobs:
fail-fast: false

container:
image: ghcr.io/pyne/pyne_ubuntu_20.04_py3${{ matrix.hdf5 }}/${{ matrix.stage }}:stable
image: ghcr.io/pyne/pyne_ubuntu_22.04_py3${{ matrix.hdf5 }}/${{ matrix.stage }}:stable

steps:
- name: setup
shell: bash -l {0}
run: |
export ADD_FLAG=" "
if [[ "${{ matrix.stage }}" == "moab" || "${{ matrix.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --moab /root/opt/moab"
fi
if [[ "${{ matrix.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --dagmc /root/opt/dagmc"
fi
if [[ "${{ matrix.hdf5 }}" == "_hdf5" ]]; then
export ADD_FLAG="${ADD_FLAG} --hdf5 /root/opt/hdf5/hdf5-1_12_0"
fi
export ADD_FLAG="${ADD_FLAG} "
echo "ADD_FLAG=${ADD_FLAG}" >> $GITHUB_ENV
pip install pytest
- name: Checkout repository
uses: actions/checkout@v3

- name: Building PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE
python setup.py install --user --clean ${{ env.ADD_FLAG}}
export PATH="$PATH:/github/home/.local/bin"
export PYTHONPATH="$PYTHONPATH:/github/home/.local/lib/python3.8/site-packages/"
cd ../
nuc_data_make

- name: Testing PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/tests
./ci-run-tests.sh
- name: use BuildTest composite action
uses: ./.github/actions/build-test
with:
stage: ${{ matrix.stage }}
hdf5: ${{ matrix.hdf5 }}

53 changes: 9 additions & 44 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- 'docker/*'
- '.github/workflows/docker_publish.yml'
- '.github/actions/build-test/action.yml'

env:
DOCKER_IMAGE_BASENAME: ghcr.io/${{ github.repository_owner }}/pyne_ubuntu_22.04_py3
Expand All @@ -19,11 +20,6 @@ jobs:
# to be built upon by the subsequent stage.
multistage_image_build:
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu_versions : [
22.04,
]
outputs:
image_tag: ${{ steps.output_tag.outputs.image_tag }}

Expand All @@ -40,7 +36,7 @@ jobs:

# build base python, moab, dagmc, openmc using multistage docker build action
- uses: firehed/multistage-docker-build-action@v1
id: build1
id: build_all_stages
with:
repository: ${{ env.DOCKER_IMAGE_BASENAME }}
stages: base_python, moab, dagmc
Expand All @@ -51,7 +47,7 @@ jobs:

# build HDF5 using multistage docker build action
- uses: firehed/multistage-docker-build-action@v1
id: build2
id: build_dagmc_with_hdf5
with:
repository: ${{ env.DOCKER_IMAGE_BASENAME }}_hdf5
stages: base_python, moab
Expand All @@ -61,11 +57,6 @@ jobs:
dockerfile: docker/ubuntu_22.04-dev.dockerfile
build-args: build_hdf5=hdf5-1_12_0

# print out server-tags
- run: |
echo ${{ steps.build1.outputs.server-tag }}
echo ${{ steps.build2.outputs.server-tag }}
- id: output_tag
run: |
echo "image_tag=$DOCKER_IMAGE_TAG" >> $GITHUB_OUTPUT
Expand All @@ -88,40 +79,14 @@ jobs:
container:
image: ghcr.io/${{ github.repository_owner }}/pyne_ubuntu_22.04_py3${{ matrix.hdf5 }}/${{ matrix.stage }}${{ needs.multistage_image_build.outputs.image_tag }}
steps:
- name: setup
shell: bash -l {0}
run: |
export ADD_FLAG=" "
if [[ "${{ matrix.stage }}" == "moab" || "${{ matrix.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --moab /root/opt/moab"
fi
if [[ "${{ matrix.stage }}" == "dagmc" ]]; then
export ADD_FLAG="${ADD_FLAG} --dagmc /root/opt/dagmc"
fi
if [[ "${{ matrix.hdf5 }}" == "_hdf5" ]]; then
export ADD_FLAG="${ADD_FLAG} --hdf5 /root/opt/hdf5/hdf5-1_12_0"
fi
export ADD_FLAG="${ADD_FLAG} "
echo "ADD_FLAG=${ADD_FLAG}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3

- name: Building PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE
python setup.py install --user --clean ${{ env.ADD_FLAG}}
export PATH="$PATH:/github/home/.local/bin"
export PYTHONPATH="$PYTHONPATH:/github/home/.local/lib/python3.10/site-packages/"
cd ../
nuc_data_make
- name: Testing PyNE
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/tests
./ci-run-tests.sh python3

- name: use BuildTest composite action
uses: ./.github/actions/build-test
with:
stage: ${{ matrix.stage }}
hdf5: ${{ matrix.hdf5 }}

# if the previous step that tests the docker images passes then the images
# can be copied from the ghcr where they are saved using :ci_testing tags to
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Next Version
* fixed compatibility issue with Python 3.10 in endf.py (#1472)
* avoid use of deprecated numpy.int alias (#1479)
* avoid use of deprecated numpy.bool alias (#1485)
* add composite action for BuildTest job in workflows (#1489)

v0.7.7
======
Expand Down

0 comments on commit fe0a590

Please sign in to comment.