Converting travis page builder to GitHub Actions.

Signed-off-by: Tim 'mithro' Ansell <tansell@google.com>
This commit is contained in:
Tim 'mithro' Ansell 2021-12-14 11:22:53 -08:00
parent 44c0c4ce35
commit c7309c692f
7 changed files with 65 additions and 33 deletions

View File

@ -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)"
@ -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 "--------------------------------------------"
@ -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 \

View File

@ -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)"
@ -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" \

View File

@ -1,2 +1,3 @@
markdown
pygments
pyyaml

View File

@ -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

42
.github/workflows/pages.yml vendored Normal file
View File

@ -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

View File

@ -1,21 +0,0 @@
language: python
python:
- "3.6"
env:
global:
- GIT_COMMITTER_NAME="SymbiYosys Travis Bot"
- GIT_COMMITTER_EMAIL="nobody@nowhere.com"
before_install:
- ./.travis/save-key.sh
- ./.travis/fix-git.sh
install:
- pip install -r ./.travis/requirements.txt
script:
- ./.travis/generate-html.sh
after_success:
- if [ -e ~/.ssh/agent.sh ]; then source ~/.ssh/agent.sh; ./.travis/push-html.sh; fi