Skip to content

Commit

Permalink
Converting travis page builder to GitHub Actions.
Browse files Browse the repository at this point in the history
Signed-off-by: Tim 'mithro' Ansell <tansell@google.com>
  • Loading branch information
mithro committed Dec 14, 2021
1 parent 44c0c4c commit c7309c6
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 33 deletions.
File renamed without changes.
15 changes: 13 additions & 2 deletions .travis/generate-html.sh → .github/scripts/generate-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ fi
# Output some information about the version of Project X-ray we are using.
(
cd $TMPDIR/prjxray
# Add upstream if it doesn't exist
if git remote -v | grep -q SymbiFlow/prjxray; then
echo "Upstream repo already exists."
else
git remote add upstream https://github.com/SymbiFlow/prjxray.git
git fetch upstream
fi
# Make sure we have tags
git fetch --tags
# Reset to the right revision
git reset --hard $PRJXRAY_INFO_REVISION
echo
echo "Project X-Ray Revision $(git describe --long --tags --always)"
Expand All @@ -60,9 +69,11 @@ fi
)

# Generate the HTML for each device we have a settings file for.
for SETTINGS in $TMPDIR/prjxray/settings/*.sh; do
for SETTINGS in $(ls $TMPDIR/prjxray/settings/*.sh | grep '7.sh$'); do
DEVICE="$(basename $SETTINGS .sh)"

export PYTHONPATH=$PYTHONPATH:$TMPDIR/prjxray

echo
echo "Generating for $DEVICE"
echo "--------------------------------------------"
Expand Down Expand Up @@ -95,7 +106,7 @@ for SETTINGS in $TMPDIR/prjxray/settings/*.sh; do

done

cp COPYING html/COPYING
cp LICENSE html/LICENSE

# Generate the index page from the Info.md file
python3 -m markdown \
Expand Down
11 changes: 7 additions & 4 deletions .travis/push-html.sh → .github/scripts/push-html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if [ ! -d html ]; then
exit 1
fi

export GIT_COMMITTER_NAME="SymbiFlow Travis Bot"
export GIT_COMMITTER_EMAIL="nobody@nowhere.com"

export GIT_AUTHOR_NAME="$(git log -1 --pretty=%an)"
export GIT_AUTHOR_EMAIL="$(git log -1 --pretty=%ae)"

Expand Down Expand Up @@ -54,12 +57,12 @@ TMPDIR=$(mktemp -d)
git status
echo "--------------------------------------------"

if [ ! -z "$TRAVIS" ]; then
if [ ! -z "$GITHUB_WORKFLOW" ]; then
git commit -a \
-m "Travis build #$TRAVIS_BUILD_NUMBER of $CURRENT_REVISION" \
-m "GitHub Actions build #$GITHUB_RUN_NUMBER of $CURRENT_REVISION" \
-m "" \
-m "From https://github.com/$TRAVIS_REPO_SLUG/tree/$TRAVIS_COMMIT" \
-m "$TRAVIS_COMIT_MESSAGE"
-m "From https://github.com/$GITHUB_REPOSITORY/tree/$GITHUB_SHA" \
-m "$CURRENT_MESSAGE"
else
git commit -a \
-m "Manual build of $CURRENT_REVISION" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
markdown
pygments
pyyaml
8 changes: 2 additions & 6 deletions .travis/save-key.sh → .github/scripts/save-key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
set -e
set +x

if [ ! -z "$TRAVIS_BRANCH" -a "$TRAVIS_BRANCH" != "master" ]; then
echo "On $TRAVIS_BRANCH, not saving key."
exit 0
fi

if [ ! -z "$GH_KEY" ]; then
mkdir -p ~/.ssh
ssh-agent > ~/.ssh/agent.sh
. ~/.ssh/agent.sh
mkdir -p ~/.ssh/
echo "$GH_KEY" | base64 -d > ~/.ssh/id_git
echo "$GH_KEY" > ~/.ssh/id_git
chmod 0400 ~/.ssh/id_git
ssh-keygen -y -f ~/.ssh/id_git > ~/.ssh/id_git.pub
ssh-add ~/.ssh/id_git
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build GitHub Pages

on:
push:
branches:
- master
workflow_dispatch:

#env:
# global:
# - GIT_COMMITTER_NAME="SymbiYosys Travis Bot"
# - GIT_COMMITTER_EMAIL="nobody@nowhere.com"

jobs:

Build-GitHub-Pages:
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Save SSH key
run: ./.github/scripts/save-key.sh
env:
GH_KEY: ${{ secrets.GH_KEY }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
cache: 'pip'

- name: Install Python Dependencies
run: pip install -r ./.github/scripts/requirements.txt

- name: Generate HTML pages
run: ./.github/scripts/generate-html.sh

- name: Push to gh-pages branch
run: if [ -e ~/.ssh/agent.sh ]; then source ~/.ssh/agent.sh; ./.github/scripts/push-html.sh; fi
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

0 comments on commit c7309c6

Please sign in to comment.