-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (132 loc) · 5.72 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
136
137
138
139
140
141
142
143
144
145
# 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, workflow_dispatch]
# A workflow run is made up of one or more jobs that can run sequentially or in parall
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-20.04
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master # See https://github.com/fkirc/skip-duplicate-actions for more details
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'always'
cancel_others: 'false'
do_not_skip: '["workflow_dispatch"]'
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
needs: pre_job
runs-on: ubuntu-latest
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
ref: "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 libgsl-dev libpapi-dev python 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
pip install bokeh==2.0.1
pip install matplotlib
pip install requests
# Clone the master branch of the einstein toolkit and copy the scripts used to run tests and parse them into that folder
- name: Use files from master
run: |
cd ..
git clone https://github.com/mojamil/einsteintoolkit/ test
cp ./einsteintoolkit/parser.py ./test
cp ./einsteintoolkit/mail.py ./test
cp ./einsteintoolkit/logpage.py ./test
cp ./einsteintoolkit/store.py ./test
cp ./einsteintoolkit/test_nums.csv ./test
cp ./einsteintoolkit/build-and-test.sh ./test
cp -r ./einsteintoolkit/records ./test
cp -r ./einsteintoolkit/docs ./test
cd test
# Run the script to build and test
# The script that runs the html script outputs if any tests are failed and that is stored as an environment variable
- name: Run build and test script
run: |
cd ..
cd test
chmod +x build-and-test.sh
./build-and-test.sh
python3 logpage.py >> $GITHUB_ENV
cd ..
cd einsteintoolkit
# The old log files are stored in the github pages branch so it is copied there to be pushed
- name: Store files
run: |
cd ..
cd test
cp -r records ../einsteintoolkit
cp -r docs ../einsteintoolkit
cp test_nums.csv ../einsteintoolkit
# Push the files that need to be preserverd for future use
- name: Add index.html and previous logs
run: |
git status
git add docs
git add records
git add test_nums.csv
- name: Commit files
run: |
git config --local user.email "msj2340@gmail.com"
git config --local user.name "mojamil"
git commit -m "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 ..
cd test
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:
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