-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github ci workflow and docker image building (#215)
* Update script to analyze forces on constraints * initial ci workflow files. * default branch name release. * create build directory for compilation. * minor fix --------- Co-authored-by: Jean-Luc Fattebert <[email protected]>
- Loading branch information
1 parent
bde368d
commit f0149cb
Showing
3 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CI | ||
on: | ||
workflow_dispatch: {} | ||
pull_request: | ||
types: [opened, labeled, synchronize] | ||
branches: | ||
- release | ||
# push: | ||
# branches: | ||
# - release | ||
|
||
jobs: | ||
docker-image: | ||
uses: ./.github/workflows/docker_image.yml | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: [docker-image] | ||
container: | ||
image: ghcr.io/llnl/mgmol/mgmol_env:latest | ||
options: --user 1001 --privileged | ||
volumes: | ||
- /mnt:/mnt | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Set Swap Space | ||
uses: pierotofy/set-swap-space@master | ||
with: | ||
swap-size-gb: 10 | ||
- name: Check out pylibROM | ||
uses: actions/checkout@v1 | ||
with: | ||
submodules: 'true' | ||
- name: Git Submodules status | ||
run: | | ||
git submodule status | ||
- name: cmake | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -DCMAKE_CXX_COMPILER=mpic++ -DCMAKE_Fortran_COMPILER=mpif90 | ||
- name: make | ||
run: | | ||
cd build && make -j 4 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: docker-image | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: llnl/mgmol/mgmol_env | ||
DOCKERPATH: docker | ||
|
||
jobs: | ||
docker-ci: | ||
runs-on: ubuntu-latest | ||
name: "docker env" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: Ana06/[email protected] | ||
id: files | ||
- name: DockerPATH configuration | ||
run: echo "DOCKERPATH=$DOCKERPATH" | ||
- name: DockerPATH - check if files in docker path changed | ||
if: contains(steps.files.outputs.all,env.DOCKERPATH) || contains(steps.files.outputs.all,'docker_image.yml') | ||
run: | | ||
echo "CI container needs rebuilding..." | ||
echo "CI_NEEDS_REBUILD=true" >> $GITHUB_ENV | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: env.CI_NEEDS_REBUILD | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
if: env.CI_NEEDS_REBUILD | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: type=sha | ||
flavor: latest=true | ||
- name: Build Container motd | ||
if: env.CI_NEEDS_REBUILD | ||
run: | | ||
echo "#!/bin/bash" > ${{env.DOCKERPATH}}/motd.sh | ||
echo "echo --------------------------" >> ${{env.DOCKERPATH}}/motd.sh | ||
echo "echo mgmol_env/CI Development Container" >> ${{env.DOCKERPATH}}/motd.sh | ||
echo "echo \"Revision: `echo ${GITHUB_SHA} | cut -c1-8`\"" >> ${{env.DOCKERPATH}}/motd.sh | ||
echo "echo --------------------------" >> ${{env.DOCKERPATH}}/motd.sh | ||
chmod 755 ${{env.DOCKERPATH}}/motd.sh | ||
cat ${{env.DOCKERPATH}}/motd.sh | ||
- name: Docker Image - Build and push | ||
if: env.CI_NEEDS_REBUILD | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
context: ${{ env.DOCKERPATH }} | ||
tags: ${{ steps.meta.outputs.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV ENVDIR=env | ||
|
||
# install sudo | ||
RUN apt-get -yq update && apt-get -yq install sudo | ||
|
||
WORKDIR /$ENVDIR | ||
|
||
# install packages | ||
RUN sudo apt-get install -yq git | ||
RUN sudo apt-get install --no-install-recommends -yq make gcc gfortran libssl-dev cmake | ||
RUN sudo apt-get install -yq libopenblas-dev libmpich-dev libblas-dev liblapack-dev libscalapack-mpi-dev libhdf5-mpich-dev | ||
RUN sudo apt-get install -yq libboost-all-dev | ||
RUN sudo apt-get install -yq vim | ||
RUN sudo apt-get install -yq git-lfs | ||
RUN sudo apt-get install -yq valgrind | ||
RUN sudo apt-get install -yq wget | ||
RUN sudo apt-get install -yq astyle | ||
|
||
# install lldb and gdb for debugging | ||
RUN sudo apt-get install -yq lldb gdb | ||
|
||
RUN sudo apt-get clean -q | ||
|
||
# NOTE: currently docker does not have a way to set environment variable with a command output. | ||
# The following environment variable should use $(uname -m) for different architecture. | ||
# ENV SCALAPACK_ROOT=/usr/lib/aarch64-linux-gnu/ | ||
ENV SCALAPACK_ROOT=/usr/lib/x86_64-linux-gnu/ | ||
|
||
# create and switch to a user | ||
ENV USERNAME=test | ||
RUN echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
RUN useradd --no-log-init -u 1001 --create-home --shell /bin/bash $USERNAME | ||
RUN adduser $USERNAME sudo | ||
USER $USERNAME | ||
WORKDIR /home/$USERNAME | ||
|