Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cache and artifact to simplify the test #8

Merged
merged 19 commits into from
Jul 20, 2024
Merged
95 changes: 63 additions & 32 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,41 @@ env:

jobs:
build:

runs-on: ubuntu-latest

steps:

- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Installling Open MPI
run: |
sudo apt-get install -y libopenmpi-dev

- name: Installing MATLAB
id: setup-matlab
uses: matlab-actions/setup-matlab@v2
with:
release: R2023b

- name: Check out repository code
uses: actions/checkout@v4

- name: Modify PETSc's installation script
run: |
echo "Removing mpich from PETSc installation script"
sed -i.bak '/mpich/d' $ISSM_DIR/externalpackages/petsc/install-3.21-linux.sh


- name: Cache externalpackages
uses: actions/cache@v3
id: cache-externalpackages
env:
cache-name: cache-triangle-m1qn3-petsc
with:
path: ${{ env.ISSM_DIR }}/externalpackages/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- name: Install External packages
if: steps.cache-externalpackages.outputs.cache-hit != 'true'
run: |
cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh
cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh
cd $ISSM_DIR/externalpackages/petsc && ./install-3.21-linux.sh
source $ISSM_DIR/etc/environment.sh


- name: Get MATLAB
id: setup-matlab
uses: matlab-actions/setup-matlab@v2
with:
release: R2023b
cache: true

- name: Reconfigure ISSM
run: |
source $ISSM_DIR/etc/environment.sh
autoreconf -ivf
./configure --prefix=${ISSM_DIR} \
--disable-static \
Expand All @@ -54,8 +53,8 @@ jobs:
--with-numthreads=4 \
--with-matlab-dir=${{ steps.setup-matlab.outputs.matlabroot }} \
--with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \
--with-mpi-include="/usr/lib/x86_64-linux-gnu/openmpi/include/" \
--with-mpi-libflags="-L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lmpi_cxx" \
--with-mpi-include="${ISSM_DIR}/externalpackages/petsc/install/include" \
--with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \
--with-petsc-dir="${ISSM_DIR}/externalpackages/petsc/install" \
--with-blas-lapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \
--with-metis-dir="${ISSM_DIR}/externalpackages/petsc/install" \
Expand All @@ -66,13 +65,45 @@ jobs:
--with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install"

- name: Compile ISSM
run: make -j8 install
run: make -j16 install

- name: Prepare MATLAB script
- name: Compress ISSM artifact
run: tar -cvf ISSM_artifact.tar -C ${{ env.ISSM_DIR }}/ .

- name: Upload ISSM artifact
uses: actions/upload-artifact@v4
with:
name: ISSM-${{ runner.os }}
path: ISSM_artifact.tar
compression-level: 1

test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download ISSM artifact
uses: actions/download-artifact@v4
with:
name: ISSM-${{ runner.os }}
path: ${{ env.ISSM_DIR }}

- name: uncompress ISSM artifact
run: |
tar -xvf ISSM_artifact.tar
rm ISSM_artifact.tar
source $ISSM_DIR/etc/environment.sh
working-directory: ${{ env.ISSM_DIR }}
shell: 'bash'

- name: Get MATLAB
id: setup-matlab
uses: matlab-actions/setup-matlab@v2
with:
release: R2023b
cache: true

- name: Creating matlab_ci.m
run: |
echo "Modifying generic.m to avoid \"There are not enough slots available\""
sed -i.back "s/mpiexec -np %i/mpiexec -np %i --oversubscribe/g" $ISSM_DIR/src/m/classes/clusters/generic.m
echo "Creating matlab_ci.m"
cat > ${ISSM_DIR}/matlab_ci.m << EOF
% Go to the test directory
cd $ISSM_DIR/test/NightlyRun/
Expand All @@ -86,15 +117,15 @@ jobs:
quit(0);
EOF
cat ${ISSM_DIR}/matlab_ci.m

- name: Get run-matlab-command
run: |
wget -O /usr/local/bin/run-matlab-command https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/glnxa64/run-matlab-command
chmod +x /usr/local/bin/run-matlab-command

- name: Run MATLAB Command
- name: Run MATLAB tests
run: |
source $ISSM_DIR/etc/environment.sh
LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 run-matlab-command "matlab_ci"
LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6:$ISSM_DIR/externalpackages/petsc/install/lib/libmpi.so:$ISSM_DIR/externalpackages/petsc/install/lib/libmpifort.so run-matlab-command "matlab_ci"

- run: echo "This job's status is ${{ job.status }}."
Loading