# Full version of FreeFem, using MPICH installed by PETSc name: Full version MPICH on: push: branches: - develop - master pull_request: branches: - develop workflow_call: inputs: build_types: description: 'Build types as JSON array' required: true type: string ubuntu_versions: description: 'Ubuntu versions as JSON array' required: true type: string skip_check: required: false type: boolean default: false skip_macos: required: false type: boolean default: false upload_build_artifacts: required: false type: boolean default: false # For development phase workflow_dispatch: # Hardcode workflow name since github.workflow is inherited from the caller. concurrency: group: MPICH-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: linux: strategy: fail-fast: false matrix: version: ${{ fromJson(inputs.ubuntu_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 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 MPICH-${{ 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 macos: if: ${{ inputs.skip_macos == false }} strategy: fail-fast: false matrix: version: [14, 15, 26] cfg: - {opts: --enable-debug} - {opts: --enable-optim --enable-generic} name: macOS ${{ matrix.version }} with ${{ matrix.cfg.opts }} \ - ${{ github.workflow }} runs-on: macos-${{ matrix.version }} steps: - uses: actions/checkout@v6 # Remove homebrew LLVM compiler, and use most recent Xcode development # tools - name: Set environment run: | if (( ${{ matrix.version }} == 15 )); then echo "LLVM_VERSION=18" >> $GITHUB_ENV sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer elif (( ${{ matrix.version }} == 14 )); then echo "LLVM_VERSION=15" >> $GITHUB_ENV sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer fi - name: Install run: | brew install m4 bison autoconf automake if (( ${{ matrix.version }} != 26 )); then brew remove llvm@$LLVM_VERSION fi - name: Symlink gfortran run: ./etc/actions/macos/link_fortran.sh "$(uname -p)" - name: CPU info run: system_profiler SPHardwareDataType - 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: Cache PETSc installation id: cache-petsc uses: actions/cache@v5 with: path: | ${{ steps.petsc-info.outputs.home }}/freefem/ff-petsc key: "petsc-Full version MPICH-${{ 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 ${{ matrix.cfg.opts }} \ --prefix="${HOME}/freefem" - name: PETSc if: steps.cache-petsc.outputs.cache-hit != 'true' run: | ./3rdparty/getall -a -o PETSc cd 3rdparty/ff-petsc 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 - name: Build run: make -j 3 - name: Check run: | make check -i ./etc/actions/failed_tests_logs.sh - name: Install run: make install