diff --git a/.github/deploy_test_preview.sh b/.github/deploy_test_preview.sh new file mode 100644 index 0000000..98d43e8 --- /dev/null +++ b/.github/deploy_test_preview.sh @@ -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 "" >> $GITHUB_PAGES_DIR/index.html diff --git a/.travis.yml b/.travis.yml index 0a99590..ad265e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: minimal +dist: bionic before_install: - make env @@ -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