forked from EinsteinToolkit/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (124 loc) · 5.73 KB
/
main.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
130
131
132
133
134
135
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Do not cancel any in-progress job or run
# As group name is defined on workflow level (not job-level), concurrency will be checked across different branches
concurrency:
group: et-tests
cancel-in-progress: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Below the runner checks-out multiple branches side by side, under different paths
# Check-out master and its submodules under $GITHUB_WORKSPACE/master, as its files are needed to run tests
- uses: actions/checkout@v3
with:
persist-credentials: false
# 0 indicates all history for all branches and tags (see https://github.com/actions/checkout)
fetch-depth: 0
path: master
submodules: recursive
# Check-out scripts branch under $GITHUB_WORKSPACE/scripts to access scripts to run
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: scripts
path: scripts
# Check-out gh-pages branch under $GITHUB_WORKSPACE/gh-pages, for pushing test report output to
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: gh-pages
path: gh-pages
# This step stores certain environment variables in a file that is on githubs clouds
- name: Create Environment Variables
run: |
echo "CHANGES_MADE=False" >> $GITHUB_ENV
echo "TESTS_FAILED=False" >> $GITHUB_ENV
# Install prerequisite libraries for einstein toolkit
- name: Install pre-requisite libraries
run: |
sudo apt update
$(sudo -l sudo) su -c 'apt-get install --fix-missing -y pkg-config subversion gcc git numactl libgit2-dev libgsl-dev libpapi-dev python-is-python3 libhwloc-dev libudev-dev make libopenmpi-dev libhdf5-openmpi-dev libfftw3-dev libssl-dev liblapack-dev g++ curl gfortran patch pkg-config libhdf5-dev libjpeg-turbo?-dev'
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Install required libraries for parsing scripts
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
# jinja2 >= 3.1 removes jinja2.Markup, causing failures:
# https://github.com/bokeh/bokeh/pull/11174
pip install jinja2==3.0.3
pip install bokeh==2.0.1
pip install matplotlib
pip install requests
pip install pygit2==1.0.3
# Run the script to build and test (build-and-test.sh) and write results to HTML pages (logpage.py)
# The script that runs the html script outputs if any tests are failed and that is stored as an environment variable
# Paths to master and gh-pages are passed as sys args to the scripts, so their files can be accessed
- name: Run build and test script
run: |
cd scripts
chmod +x build-and-test.sh
./build-and-test.sh --master $GITHUB_WORKSPACE/master --ghpages $GITHUB_WORKSPACE/gh-pages
python3 logpage.py --master $GITHUB_WORKSPACE/master --ghpages $GITHUB_WORKSPACE/gh-pages
# Push the files from gh-pages that need to be preserved for future use
- name: Add index.html and previous logs from gh-pages
run: |
cd gh-pages
git status
git add docs
git add records
git add test_nums.csv
- name: Commit files from gh-pages
run: |
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "github runner"
git commit -m "CI workflow updated html file" || true
# # If there were changes made while this workflow is running set the environment variable CHANGES_MADE to true
- name: Check for changes
run: |
cd gh-pages
git fetch origin # fetch changes from origin remote
if ! git diff --quiet master..origin/master ; then
echo "CHANGES_MADE=True" >> $GITHUB_ENV
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "gh-pages"
# For more info on workflow dispathces see https://github.com/benc-uk/workflow-dispatch
- name: Workflow Dispatch
# You may pin to the exact commit or the version.
# uses: benc-uk/workflow-dispatch@4c044c1613fabbe5250deadc65452d54c4ad4fc7
if: ${{env.CHANGES_MADE == 'True'}}
uses: benc-uk/workflow-dispatch@v1
with:
# Name or ID of workflow to run
workflow: 'CI'
# GitHub token with repo write access, can NOT use secrets.GITHUB_TOKEN, see readme
token: ${{ secrets.PERSONAL_TOKEN }}
# If a test failed the workflow exit with a failing status
- name: Clean up
if: ${{env.TESTS_FAILED == 'True'}}
run: exit 1