Skip to content

Commit

Permalink
GH Action to build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed Nov 12, 2022
1 parent affd441 commit 4bf8ccf
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/scripts/install_linux.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions .github/scripts/install_macos.sh
Original file line number Diff line number Diff line change
@@ -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
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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

0 comments on commit 4bf8ccf

Please sign in to comment.