# Full version of FreeFem, using Open MPI name: Full version Open MPI on: push: branches: - develop - master pull_request: branches: - develop workflow_call: inputs: build-types: description: 'Build types as JSON array' required: false type: string default: '["debug", "release"]' versions: description: 'Ubuntu version as JSON array' required: false type: string default: '[22.04, 24.04]' skip_check: required: false type: boolean default: false upload_build_artifacts: required: false type: boolean default: false # For development phase workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: linux: strategy: fail-fast: false matrix: version: ${{ fromJson(inputs.versions || '[22.04, 24.04]') }} build-type: ${{ fromJson(inputs.build-types || '["debug", "release"]') }} name: Ubuntu ${{ matrix.version }} with ${{ matrix.build-type }} \ - ${{ github.workflow }} env: INSTALL_DIR: /usr/local runs-on: ubuntu-${{ matrix.version }} steps: - uses: actions/checkout@v6 - name: Install dependencies run: | sudo apt update sudo apt install -y gcc g++ gfortran m4 patch git wget cmake \ libhdf5-dev flex bison autoconf automake unzip patch \ autotools-dev libopenmpi-dev python3 freeglut3-dev - name: Set configure flags and variables id: flags run: | if [ "${{ matrix.build-type }}" = "debug" ]; then echo "configure-flags=--enable-debug" >> $GITHUB_OUTPUT elif [ "${{ matrix.build-type }}" = "release" ]; then echo "configure-flags=--enable-optim --enable-generic" >> $GITHUB_OUTPUT fi echo "staging-dir=${{ github.workspace }}/install_staging" >> $GITHUB_OUTPUT - name: CPU info run: lscpu - name: Extract PETSc and runner info id: petsc-info run: | VERSION=$(grep -E -o "petsc-([0-9]{1,}\.)+[0-9]{1,}" 3rdparty/getall | head -1) echo "version=$VERSION" >> $GITHUB_OUTPUT echo "image=$ImageOS" >> $GITHUB_OUTPUT echo "home=$HOME" >> $GITHUB_OUTPUT - name: Prepare PETSc cache directory permissions run: | sudo mkdir -p "${INSTALL_DIR}/ff-petsc" sudo chown -R "$USER:$USER" "${INSTALL_DIR}/ff-petsc" - name: Cache PETSc installation id: cache-petsc uses: actions/cache@v5 with: path: | ${{ env.INSTALL_DIR }}/ff-petsc key: "petsc-Full version Open MPI-${{ steps.petsc-info.outputs.image }}-${{ matrix.cfg.opts }}-${{ steps.petsc-info.outputs.version }}-${{ hashFiles('3rdparty/ff-petsc/Makefile') }}" - name: Configure run: | autoreconf -i ./configure --enable-download ${{ steps.flags.outputs.configure-flags }} \ --prefix="$INSTALL_DIR" - name: PETSc if: steps.cache-petsc.outputs.cache-hit != 'true' run: | ./3rdparty/getall -a -o PETSc cd 3rdparty/ff-petsc sudo make petsc-slepc cd - ./reconfigure - name: Upload PETSc and reconfigure logs on fail if: ${{ failure() }} uses: actions/upload-artifact@v7 with: name: PETSc-reconfigure-logs path: | 3rdparty/ff-petsc/petsc-*/configure.log config.log compression-level: 9 # Weird problem of permission on libfftw3.la without sudo - name: Build run: sudo make -j 4 - name: Check if: ${{ inputs.skip_check == false }} run: | make check -i ./etc/actions/failed_tests_logs.sh - name: Install to staging directory if: ${{ inputs.upload_build_artifacts == true }} run: | mkdir -p ${{ steps.flags.outputs.staging-dir }}/$INSTALL_DIR sudo make install DESTDIR=${{ steps.flags.outputs.staging-dir }} sudo cp -r $INSTALL_DIR/ff-petsc ${{ steps.flags.outputs.staging-dir }}/$INSTALL_DIR - name: Tar to keep permission when upload/download if: ${{ inputs.upload_build_artifacts == true }} run: | cd ${{ steps.flags.outputs.staging-dir }}/${{ env.INSTALL_DIR }} tar czf ${{ github.workspace }}/install_tree.tar.gz . - name: Upload if: ${{ inputs.upload_build_artifacts == true }} uses: actions/upload-artifact@v7 with: name: install_tree_${{ matrix.version }} path: install_tree.tar.gz retention-days: 1 # No test for macOS, the homebrew bottle open-mpi seems broken.