This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
129 lines (114 loc) · 3.66 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI
on:
push:
paths-ignore:
- '**.md'
pull_request:
branches:
- main
- develop*
paths-ignore:
- '**.md'
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019, windows-2022 ]
path: [ absolute, relative, tilde, default ]
setvars: [ 'true', 'false' ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set bin path
if: runner.os != 'Windows'
run: |
if [ "${{ matrix.path }}" == "absolute" ]; then
bindir="$HOME/.local/bin"
elif [ "${{ matrix.path }}" == "relative" ]; then
bindir="bin"
elif [ "${{ matrix.path }}" == "tilde" ]; then
bindir="~/.local/bin"
else
# action's default location
bindir="~/.local/bin/ifort"
fi
echo "TEST_BINDIR=$bindir" >> $GITHUB_ENV
- name: Set bin path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
if ("${{ matrix.path }}" -eq "absolute") {
# $bindir = "C:\Users\runneradmin\.local\bin"
$bindir = "C:\Program Files (x86)\Intel\oneAPI"
} elseif ("${{ matrix.path }}" -eq "relative") {
$bindir = "bin"
} elseif ("${{ matrix.path }}" -eq "tilde") {
$bindir = "~/.local/bin"
} else {
# actions's default location
$bindir = "~/.local/bin/ifort"
}
echo "TEST_BINDIR=$bindir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install compilers
if: matrix.path != 'default'
uses: ./
with:
path: ${{ env.TEST_BINDIR }}
setvars: ${{ matrix.setvars }}
- name: Install compilers
if: matrix.path == 'default'
uses: ./
with:
setvars: ${{ matrix.setvars }}
- name: Set environment variables
if: runner.os != 'Windows' && matrix.setvars != 'true'
shell: bash
run: |
source "$INTEL_HPCKIT_INSTALL_PATH/setvars.sh"
env | grep oneapi >> $GITHUB_ENV
- name: Set environment variables
if: runner.os == 'Windows' && matrix.setvars != 'true'
shell: cmd
run: |
call "%INTEL_HPCKIT_INSTALL_PATH%\compiler\%INTEL_COMPILER_VERSION%\env\vars.bat"
set | findstr /c:"oneAPI" >> "%GITHUB_ENV%"
# not needed atm, but just in case any future tests require this
- name: Set SETVARS_COMPLETED
if: matrix.setvars != 'true'
shell: bash
run: echo "SETVARS_COMPLETED=1" >> $GITHUB_ENV
- name: Test compilers (Linux & Mac)
if: runner.os != 'Windows'
run: ./test/test.sh ${{ env.TEST_BINDIR }}
- name: Test compilers (Windows bash)
if: runner.os == 'Windows'
shell: bash
run: |
if command -v ifort &> /dev/null
then
echo "ifort found"
else
echo "ifort not available"
exit 1
fi
ifort test/hw.f90 -o hw
output=$(./hw '2>&1')
if [[ "$output" == *"hello world"* ]]
then
echo "compile succeeded"
echo "$output"
else
echo "unexpected output: $output"
exit 1
fi
- name: Test compilers (Windows pwsh)
if: runner.os == 'Windows'
shell: pwsh
run: ./test/test.ps1 "${{ env.TEST_BINDIR }}"
- name: Test compilers (Windows cmd)
if: runner.os == 'Windows'
shell: cmd
run: call "./test/test.bat"