Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy test HTMLs to GitHub Pages #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/deploy_test_preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

GITHUB_PAGES_DIR=$TRAVIS_BUILD_DIR/tests/gh-pages

MONOLITH_DOWNLOAD_URL=https://github.com/Y2Z/monolith/releases/download/v2.3.1/monolith-gnu-linux-x86_64
MONOLITH_DOWNLOAD_DIR=/tmp/monolith
MONOLITH_PATH=$MONOLITH_DOWNLOAD_DIR/monolith

# Make the script verbose

set -x

# Enter the conda environment

source $TRAVIS_BUILD_DIR/env/conda/bin/activate sphinxcontrib-verilog-diagrams

# Update the machine and install prerequisites

sudo apt update
sudo apt install -y wget libssl-dev

# Download monolith and add it to the PATH

mkdir -p $MONOLITH_DOWNLOAD_DIR
wget $MONOLITH_DOWNLOAD_URL -O $MONOLITH_PATH
sudo chmod u+rwx $MONOLITH_PATH

# Create directory for GitHub Pages

mkdir -p $GITHUB_PAGES_DIR

# Generate test HTMLs

cd $TRAVIS_BUILD_DIR/tests && make test

# Open HTTP server

cd $TRAVIS_BUILD_DIR/tests/build
python3 -m http.server 8000 &
sleep 1

# Convert test HTMLs and create the index for GitHub Pages

echo "<html><body><ul>" > $GITHUB_PAGES_DIR/index.html
echo "<h1> Verilog Diagrams Tests </h1>" >> $GITHUB_PAGES_DIR/index.html
HTML_FILES=$(find -name "test_*.html")
for file in $HTML_FILES
do
FILE_NAME=$(basename $file)
FILE_NO_EXT_NAME=$(basename $file .html)
echo "<li><a href=\"$FILE_NAME\">$FILE_NO_EXT_NAME</a></li>" >> $GITHUB_PAGES_DIR/index.html
$MONOLITH_PATH http://127.0.0.1:8000/$file -o $GITHUB_PAGES_DIR/$FILE_NAME
done
echo "</ul></body></html>" >> $GITHUB_PAGES_DIR/index.html
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: minimal
dist: bionic

before_install:
- make env
Expand Down Expand Up @@ -45,3 +46,15 @@ jobs:
distributions: sdist bdist_wheel
skip_existing: true
edge: true # opt in to dpl v2

- stage: Deploy
name: "Test HTMLs"
before_deploy:
- bash $TRAVIS_BUILD_DIR/.github/deploy_test_preview.sh
deploy:
- provider: pages
skip_cleanup: true
token: $GITHUB_PAGES_TOKEN
local_dir: $TRAVIS_BUILD_DIR/tests/gh-pages
on:
branch: master