3
3
push :
4
4
branches :
5
5
- master
6
+ pull_request :
7
+ types : [opened, synchronize, reopened, closed]
6
8
7
9
jobs :
8
10
build-and-deploy :
@@ -14,30 +16,37 @@ jobs:
14
16
with :
15
17
access_token : ${{ github.token }}
16
18
- name : Add Intel repository
19
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
17
20
run : |
18
21
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
19
22
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
20
23
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
21
24
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
22
25
sudo apt-get update
23
26
- name : Install Intel OneAPI
27
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
24
28
run : |
25
29
sudo apt-get install intel-oneapi-dpcpp-cpp-compiler
26
30
- name : Install Lua
31
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
27
32
run : |
28
33
sudo apt-get install liblua5.2-dev
29
34
- name : Install Doxygen
35
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
30
36
run : |
31
37
sudo apt-get install doxygen
32
38
- name : Install CMake
39
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
33
40
run : |
34
41
sudo apt-get install cmake
35
42
- name : Setup Python
43
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
36
44
uses : actions/setup-python@v2
37
45
with :
38
46
python-version : ' 3.8'
39
47
architecture : x64
40
48
- name : Install sphinx dependencies
49
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
41
50
shell : bash -l {0}
42
51
run : |
43
52
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz
@@ -46,12 +55,14 @@ jobs:
46
55
with :
47
56
fetch-depth : 0
48
57
- name : Build dpctl
58
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
49
59
shell : bash -l {0}
50
60
run : |
51
61
source /opt/intel/oneapi/setvars.sh
52
62
python setup.py develop
53
63
python -c "import dpctl; print(dpctl.__version__)"
54
64
- name : Build docs
65
+ if : ${{ !github.event.pull_request || github.event.action != 'closed' }}
55
66
shell : bash -l {0}
56
67
run : |
57
68
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
69
80
git clean -dfx
70
81
cd ..
71
82
- name : Publish docs
83
+ if : ${{ github.ref == 'refs/heads/master' }}
72
84
shell : bash -l {0}
73
85
run : |
74
86
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
80
92
mv ~/docs/* .
81
93
git add .
82
94
git config --global user.name 'github-actions[doc-deploy-bot]'
83
- git config --gloabl user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
95
+ git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
84
96
git commit -m "Latest docs."
85
97
git push tokened_docs gh-pages
98
+ - name : Publish pull-request docs
99
+ if : ${{ github.event.pull_request && github.event.action != 'closed' }}
100
+ env :
101
+ PR_NUM : ${{ github.event.number }}
102
+ shell : bash -l {0}
103
+ run : |
104
+ git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
105
+ git fetch tokened_docs
106
+ git checkout --track tokened_docs/gh-pages
107
+ echo `pwd`
108
+ [ -d pulls/${PR_NUM} ] && git rm -rf pulls/${PR_NUM}
109
+ mkdir -p pulls/${PR_NUM}
110
+ cd pulls/${PR_NUM}
111
+ mv ~/docs/* .
112
+ git add .
113
+ git config --global user.name 'github-actions[doc-deploy-bot]'
114
+ git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
115
+ git commit -m "Docs for pull request ${PR_NUM}"
116
+ git push tokened_docs gh-pages
117
+ - name : Unpublished pull-request docs
118
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
119
+ env :
120
+ PR_NUM : ${{ github.event.number }}
121
+ shell : bash -l {0}
122
+ run : |
123
+ git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
124
+ git fetch tokened_docs
125
+ git checkout --track tokened_docs/gh-pages
126
+ echo `pwd`
127
+ [ -d pulls/${PR_NUM} ] && git rm -rf pulls/${PR_NUM}
128
+ git config --global user.name 'github-actions[doc-deploy-bot]'
129
+ git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
130
+ git commit -m "Removing docs for closed pull request ${PR_NUM}"
131
+ git push tokened_docs gh-pages
132
+ - name : Comment with URL to published pull-request docs
133
+ if : ${{ github.event.pull_request && github.event.action != 'closed' }}
134
+ env :
135
+ PR_NUM : ${{ github.event.number }}
136
+ uses : mshick/add-pr-comment@v1
137
+ with :
138
+ message : |
139
+ View rendered docs @ https://intelpython.github.io/dpctl/pulls/${{ env.PR_NUM }}/index.html
140
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
141
+ repo-token-user-login : ' github-actions[bot]'
142
+ - name : Comment with URL about removal of PR docs
143
+ if : ${{ github.event.pull_request && github.event.action == 'closed' }}
144
+ env :
145
+ PR_NUM : ${{ github.event.number }}
146
+ uses : mshick/add-pr-comment@v1
147
+ with :
148
+ message : |
149
+ Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. :crossed_fingers:
150
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
151
+ repo-token-user-login : ' github-actions[bot]'
0 commit comments