Skip to content

Commit

Permalink
add Dockerfile and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibbelink committed Nov 12, 2023
1 parent 6ee8f56 commit 860eb11
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build/Test for PR and collaborator push

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths-ignore:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
- 'doc/**'
push:
paths-ignore:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
- 'doc/**'

jobs:
build-and-test:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ubuntu_versions : [
20.04,
22.04,
]
pkg_mgr : [
apt,
conda,
]
cyclus_tag: [
latest,
]

container:
image: ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{matrix.cyclus_tag}}

steps:
- name: Checkout Cycamore
uses: actions/checkout@v3

- name: Change Home
run: |
echo "HOME=/root" >> "$GITHUB_ENV"
- name: Build Cycamore
run: |
python install.py --prefix=/root/.local -j 2 --build-type=Release --core-version 99999.99999
- name: Cycamore Unit Tests
run: |
cycamore_unit_tests
- name: Cycamore Python Tests
run: |
cd tests && python -m pytest
63 changes: 63 additions & 0 deletions .github/workflows/build_test_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Test Dependency Images

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'
push:
branches:
- main
paths:
- '.github/workflows/build_test_publish.yml'
- 'docker/**'

jobs:
build-dependency-and-test-img:
runs-on: ubuntu-latest

strategy:
matrix:
ubuntu_versions : [
20.04,
22.04,
]
pkg_mgr : [
apt,
conda,
]

name: Installing Dependencies, Building cyclus and running tests
steps:
- name: default environment
run: |
echo "tag-latest-on-default=false" >> "$GITHUB_ENV"
- name: condition on trigger parameters
if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/main' }}
run: |
echo "tag-latest-on-default=true" >> "$GITHUB_ENV"
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Installing Dependencies in Docker image
uses: firehed/multistage-docker-build-action@v1
with:
repository: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}
stages: cycamore
server-stage: cycamore-test
quiet: false
parallel: true
tag-latest-on-default: ${{ env.tag-latest-on-default }}
dockerfile: docker/Dockerfile
build-args: pkg_mgr=${{ matrix.pkg_mgr }}, ubuntu_version=${{ matrix.ubuntu_versions }}
16 changes: 16 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG pkg_mgr=apt
ARG ubuntu_version=22.04

FROM ghcr.io/cyclus/cyclus_${ubuntu_version}_${pkg_mgr}/cyclus as cycamore
ARG make_cores=2

COPY . /cycamore
WORKDIR /cycamore

RUN python install.py -j ${make_cores} --build-type=Release --core-version 99999.99999

FROM cycamore as cycamore-test
RUN cycamore_unit_tests

FROM cycamore as cycamore-pytest
RUN cd tests && python -m pytest

0 comments on commit 860eb11

Please sign in to comment.