Skip to content

Commit bf4503e

Browse files
committed
Deploy test HTMLs to GitHub Pages
This commit adds the next job to Travis CI, which produces the HTMLs of all the tests and deploys them to GitHub pages. Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
1 parent 5dd51d7 commit bf4503e

File tree

2 files changed

+80
-11
lines changed

2 files changed

+80
-11
lines changed

.github/deploy_test_preview.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
GITHUB_PAGES_DIR=$TRAVIS_BUILD_DIR/tests/gh-pages
4+
5+
MONOLITH_DOWNLOAD_URL=https://github.com/Y2Z/monolith/releases/download/v2.3.1/monolith-gnu-linux-x86_64
6+
MONOLITH_DOWNLOAD_DIR=/tmp/monolith
7+
MONOLITH_PATH=$MONOLITH_DOWNLOAD_DIR/monolith
8+
9+
# Make the script verbose
10+
11+
set -x
12+
13+
# Enter the conda environment
14+
15+
source $TRAVIS_BUILD_DIR/env/conda/bin/activate sphinxcontrib-verilog-diagrams
16+
17+
# Update the machine and install prerequisites
18+
19+
sudo apt update
20+
sudo apt install -y wget libssl-dev
21+
22+
# Download monolith and add it to the PATH
23+
24+
mkdir -p $MONOLITH_DOWNLOAD_DIR
25+
wget $MONOLITH_DOWNLOAD_URL -O $MONOLITH_PATH
26+
sudo chmod u+rwx $MONOLITH_PATH
27+
28+
# Create directory for GitHub Pages
29+
30+
mkdir -p $GITHUB_PAGES_DIR
31+
32+
# Generate test HTMLs
33+
34+
cd $TRAVIS_BUILD_DIR/tests && make test
35+
36+
# Open HTTP server
37+
38+
cd $TRAVIS_BUILD_DIR/tests/build
39+
python3 -m http.server 8000 &
40+
sleep 1
41+
42+
# Convert test HTMLs and create the index for GitHub Pages
43+
44+
echo "<html><body><ul>" > $GITHUB_PAGES_DIR/index.html
45+
echo "<h1> Verilog Diagrams Tests </h1>" >> $GITHUB_PAGES_DIR/index.html
46+
HTML_FILES=$(find -name "test_*.html")
47+
for file in $HTML_FILES
48+
do
49+
FILE_NAME=$(basename $file)
50+
FILE_NO_EXT_NAME=$(basename $file .html)
51+
echo "<li><a href=\"$FILE_NAME\">$FILE_NO_EXT_NAME</a></li>" >> $GITHUB_PAGES_DIR/index.html
52+
$MONOLITH_PATH http://127.0.0.1:8000/$file -o $GITHUB_PAGES_DIR/$FILE_NAME
53+
done
54+
echo "</ul></body></html>" >> $GITHUB_PAGES_DIR/index.html

.travis.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: minimal
2+
dist: bionic
23

34
before_install:
45
- make env
@@ -7,6 +8,7 @@ stages:
78
- name:
89
- Test
910
- Build
11+
- Deploy
1012

1113
jobs:
1214
- stage: Tests
@@ -32,14 +34,27 @@ jobs:
3234
script:
3335
- make build
3436

35-
before_deploy:
36-
- make clean
37-
- make sphinxcontrib_verilog_diagrams/version.py
38-
- sudo ln -sf /usr/bin/python3 /usr/bin/python
39-
40-
deploy:
41-
provider: pypi
42-
username: __token__
43-
distributions: sdist bdist_wheel
44-
skip_existing: true
45-
edge: true # opt in to dpl v2
37+
- stage: Deploy
38+
name: "PyPI"
39+
before_deploy:
40+
- make clean
41+
- make sphinxcontrib_verilog_diagrams/version.py
42+
- sudo ln -sf /usr/bin/python3 /usr/bin/python
43+
deploy:
44+
provider: pypi
45+
username: __token__
46+
distributions: sdist bdist_wheel
47+
skip_existing: true
48+
edge: true # opt in to dpl v2
49+
50+
- stage: Deploy
51+
name: "Test HTMLs"
52+
before_deploy:
53+
- bash $TRAVIS_BUILD_DIR/.github/deploy_test_preview.sh
54+
deploy:
55+
- provider: pages
56+
skip_cleanup: true
57+
token: $GITHUB_PAGES_TOKEN
58+
local_dir: $TRAVIS_BUILD_DIR/tests/gh-pages
59+
on:
60+
branch: master

0 commit comments

Comments
 (0)