From 4bf8ccff5bdc85b0d1ddf7c628523b115bfc1b7d Mon Sep 17 00:00:00 2001 From: Dominique Orban Date: Sat, 12 Nov 2022 11:34:03 -0500 Subject: [PATCH] GH Action to build and test --- .github/scripts/install_linux.sh | 23 +++++++++ .github/scripts/install_macos.sh | 20 ++++++++ .github/workflows/ci.yml | 82 ++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100755 .github/scripts/install_linux.sh create mode 100755 .github/scripts/install_macos.sh create mode 100644 .github/workflows/ci.yml diff --git a/.github/scripts/install_linux.sh b/.github/scripts/install_linux.sh new file mode 100755 index 0000000..c39b0a5 --- /dev/null +++ b/.github/scripts/install_linux.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +URL=$1 +COMPONENTS=$2 + +curl --output webimage.sh --url "$URL" --retry 5 --retry-delay 5 +chmod +x webimage.sh +./webimage.sh -x -f webimage_extracted --log extract.log +rm -rf webimage.sh +WEBIMAGE_NAME=$(ls -1 webimage_extracted/) +if [ -z "$COMPONENTS" ]; then + sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --eula=accept --log-dir=. + installer_exit_code=$? +else + sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=. + installer_exit_code=$? +fi +rm -rf webimage_extracted +exit $installer_exit_code diff --git a/.github/scripts/install_macos.sh b/.github/scripts/install_macos.sh new file mode 100755 index 0000000..9c24601 --- /dev/null +++ b/.github/scripts/install_macos.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2022 Intel Corporation +# +# SPDX-License-Identifier: MIT + +URL=$1 +COMPONENTS=$2 + +curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5 +hdiutil attach webimage.dmg +if [ -z "$COMPONENTS" ]; then + sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --log-dir=. + installer_exit_code=$? +else + sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=. + installer_exit_code=$? +fi +hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet +exit $installer_exit_code diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a931fc3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,82 @@ +name: CI +on: + push: + branches: + - master + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: SIFDecode ${{ matrix.os }} ${{ matrix.compiler }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + compiler: gnu + input: '6\n2\n2\nnny' + arch: 'pc64.lnx.gfo' + - os: macos-latest + compiler: gnu + input: '13\n1\nnny' + arch: 'mac64.osx.gfo' + - os: ubuntu-latest + compiler: intel + input: '6\n2\n3\nnny' + hpckit: 'https://registrationcenter-download.intel.com/akdlm/irc_nas/18975/l_HPCKit_p_2022.3.1.16997_offline.sh' + script: 'install_linux.sh' + arch: 'pc64.lnx.ifr' + - os: macos-latest + compiler: intel + input: '13\n2\nnny' + hpckit: 'https://registrationcenter-download.intel.com/akdlm/irc_nas/18977/m_HPCKit_p_2022.3.1.15344_offline.dmg' + script: 'install_macos.sh' + arch: 'mac64.osx.ifr' + runs-on: ${{ matrix.os }} + env: + ARCHDEFS: ${{ github.workspace }}/ARCHDefs + SIFDECODE: ${{ github.workspace }} + MASTSIF: ${{ github.workspace }}/sif + steps: + - name: Set up Homebrew + if: matrix.compiler == 'gnu' + uses: Homebrew/actions/setup-homebrew@master + - name: Check out + uses: actions/checkout@v3 + - name: Download ARCHDefs + id: download-archdefs + uses: robinraju/release-downloader@v1.5 + with: + repository: "ralna/ARCHDefs" + latest: true + tarBall: true + out-file-path: "" + - name: Unpack ARCHDefs + run: | + tar zxf ARCHDefs-${{ steps.download-archdefs.outputs.tag_name }}.tar.gz + mv ralna-ARCHDefs-* ARCHDefs + - name: Install GNU C and Fortran compilers + if: matrix.compiler == 'gnu' + run: | + brew update + eval $(brew shellenv) + brew install gcc + - name: Install Intel OneAPI C and Fortran compilers + if: matrix.compiler == 'intel' + run: | + .github/scripts/${{ matrix.script }} "${{ matrix.hpckit }}" all + - name: Build + run: | + [[ "${{ matrix.compiler }}" == "intel" ]] && source /opt/intel/oneapi/setvars.sh + cd $SIFDECODE + printf "${{ matrix.input }}" > install_config + ./install_sifdecode < install_config + - name: Test + run: | + [[ "${{ matrix.compiler }}" == "intel" ]] && source /opt/intel/oneapi/setvars.sh + $SIFDECODE/bin/sifdecoder --help + $SIFDECODE/bin/sifdecoder -A ${{ matrix.arch }} ROSENBR.SIF + # check that all output files exist (EXTER.f is allowed to be empty) + [[ -s "OUTSDIF.d" && -s "AUTOMAT.d" && -f "EXTER.f" && -s "RANGE.f" && -s "ELFUN.f" && -s "GROUP.f" ]] || exit 1 +