From 74219aca2d9aa12c09dbb3d65d44da946bab58a3 Mon Sep 17 00:00:00 2001 From: Fmazin Date: Fri, 14 May 2021 12:44:49 +0200 Subject: [PATCH] Added gh action for site building --- .github/workflows/site_build.yml | 65 ++++++++++++++++++++++++++++++++ .npmignore | 1 - .travis.yml | 56 --------------------------- CONTRIBUTING.md | 5 +-- README.md | 2 +- codemeta.json | 2 +- docs/site_build.sh | 39 ------------------- 7 files changed, 69 insertions(+), 101 deletions(-) create mode 100644 .github/workflows/site_build.yml delete mode 100644 .travis.yml delete mode 100755 docs/site_build.sh diff --git a/.github/workflows/site_build.yml b/.github/workflows/site_build.yml new file mode 100644 index 0000000..73a37be --- /dev/null +++ b/.github/workflows/site_build.yml @@ -0,0 +1,65 @@ +name: Build site + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + deploy-site: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: 14.16.0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + # Action for collection of short branchname in commit mesage + - name: Inject short variables + uses: rlespinasse/github-slug-action@v3.x + - name: Nodes packages + run: | + npm install + + - name: Debug script Mac and Linux + if: runner.os == 'Linux' || runner.os == 'macOS' + run: DEBUG=* npm run-script testci + + - name: Debug script Windows + if: runner.os == 'Windows' + run: $DEBUG = 'npm', 'run-script', 'testci' + + - name: Setup pip packages + run: | + pip install -r docs/requirements.txt + shopt -s expand_aliases + + - name: Build the documentation + run: mkdocs build --clean --verbose + + - name: Replace current build version and date + run: | + CURRENT_VERSION=$(git log --pretty=format:'%h' -n 1) + CURRENT_DATE=$(git show -s --format=%ci $CURRENT_VERSION) + echo $CURRENT_VERSION "@" $CURRENT_DATE + sed -i "s/@@VERSION@@/$CURRENT_VERSION/g" site/index.html + sed -i "s/@@TIMESTAMP@@/$CURRENT_DATE/g" site/index.html + + - name: Deploy to Github pages + uses: JamesIves/github-pages-deploy-action@4.1.3 + with: + branch: gh-pages # The branch the action should deploy to. + folder: site # The folder the action should deploy. + commit-message: Rebuild pages at ${{github.sha}} with branch ${{ env.GITHUB_REF_SLUG }} + git-config-name: Build bot + git-config-email: o2r.projekt@uni-muenster.de \ No newline at end of file diff --git a/.npmignore b/.npmignore index af7d097..e4b79ed 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -.travis.yml .vscode etc test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 40785ff..0000000 --- a/.travis.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -cache: - directories: - - "node_modules" - -jobs: - include: - - os: linux - language: node_js - node_js: - - "8" - install: - - npm install - script: - - DEBUG=* npm run-script testci - - os: linux - language: node_js - node_js: - - "12" - install: - - npm install - script: - - DEBUG=* npm run-script testci - - os: osx - language: node_js - node_js: - - "12" - install: - - npm install - script: - - DEBUG=* npm run-script testci - - os: windows - language: node_js - node_js: - - "12" - install: - - npm install - script: - - DEBUG=* npm run-script testci - - - language: python - python: "3.7" - if: branch = master AND type != pull_request - script: - - pip install -r docs/requirements.txt - - shopt -s expand_aliases - - |- - if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' && $TRAVIS_REPO_SLUG == $GH_SLUG ]]; then - ./docs/site_build.sh - fi - env: - - SITE_URL: https://o2r.info/erc-checker - - GH_USER_NAME: "Opening Reproducible Research" - - GH_USER_EMAIL: openingrr@uni-muenster.de - - GH_SLUG: o2r-project/erc-checker - - secure: "V/NaKUxFldF7rW++oJ59iioE1PylU464wbhj6HZuW7lAiIx4V/Hi+nlGIrsYNmgc2qdWYx+4fXYg2HUWIgLy9+e1PSZ1V2k4JH1yvJorAqh+HeUBUC4lw+AjKMeaxu/zUERAgqOtOs7jWGSHiDtWwHPC0M7+d5GMra93fcLe+NpIuF9+MzcGCkyij49/lXypQVUYWWBP6ONZG5TdXXVtKMwSi0yWkRfj5jERiKBc1upoxnOCX0vboPeNB2/eBqXcrYCRhnt97kzmbjtDn6yzktj6t5jcZsBtQZve5N8LABcGRbDQIxeYu8u3ghYhuOr+6j1KkuIYLnGwiC0clncGsaGtIRz9rJNsFRxK0BCmonj9+ZkYIJWPYoQtu54Q/fbAGrYlhJPQR4REexaCcP0ltSpykP2Qv/2rlvrRVxTPDrig6YU8ChiMZYydgPyRLSFPd5Je8CYwIS24p4+WizX0AR/Lpx4ZVypoQeycRHH+/BNuh4BlzgVu1Rd3SzwAifu75f35ajN9nyPYqD/GNsSG20LVFtemR4EJjsUzKqgpUKRDe53qH4ztkjecmYfMGLT6Qw/BCXp0dOH5PnV95/NLDwh2Oc8OP3//zykyYJITg+CHE/OW+/PTMG/3DHHbXqDoRo1rwqoK2qdJOuFIeFgr6yeFfgrREehJZL5xsuleyGM=" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3168637..36d6510 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,7 @@ npm test ## Contribute documentation -Documentation is build based on Markdown files in the `/docs` directory and rendered into static HTML pages with [mkdocs]() using Travis CI (see `.travis.yml`). +Documentation is build based on Markdown files in the `/docs` directory and rendered into static HTML pages with [mkdocs]() using a Github Action (see `.github/workflows/site_build.yml`). **View docs locally** using Python 3: @@ -80,8 +80,7 @@ mkdocs build --clean --verbose ## Online documentation -The online documentation is automatically built by Travis CI, see file `.travis.yml`. -For background on the personal access token see [https://github.com/o2r-project/erc-spec#automated-builds](https://github.com/o2r-project/erc-spec#automated-builds). +The online documentation is automatically built by a Github Action, see file `.github/workflows/site_build.yml`. ## Development hints diff --git a/README.md b/README.md index a2e2151..187d28f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # erc-checker -[![Build Status](https://travis-ci.org/o2r-project/erc-checker.svg?branch=master)](https://travis-ci.org/o2r-project/erc-checker) [![Build status](https://ci.appveyor.com/api/projects/status/xbla7j4wpbwauk7p/branch/master?svg=true)](https://ci.appveyor.com/project/nuest/erc-checker-r035a/branch/master) [![npm](https://img.shields.io/npm/v/erc-checker.svg)](https://www.npmjs.com/package/erc-checker) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2203843.svg)](https://doi.org/10.5281/zenodo.2203843) [![SWH](https://archive.softwareheritage.org/badge/swh:1:dir:a67e6dcbe3a1b5b38aad94fea4095324cd09607a/)](https://archive.softwareheritage.org/swh:1:dir:a67e6dcbe3a1b5b38aad94fea4095324cd09607a;origin=https://github.com/o2r-project/erc-checker.git;visit=swh:1:snp:e3d5cd96bdcee333417ea2192584060bef2a77ac;anchor=swh:1:rev:41e32824d581e763c58004e498c1bf1f343ef6c7;path=//) +![badge for workflow status](https://github.com/o2r-project/erc-checker/actions/workflows/site_build.yml/badge.svg) [![Build status](https://ci.appveyor.com/api/projects/status/xbla7j4wpbwauk7p/branch/master?svg=true)](https://ci.appveyor.com/project/nuest/erc-checker-r035a/branch/master) [![npm](https://img.shields.io/npm/v/erc-checker.svg)](https://www.npmjs.com/package/erc-checker) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2203843.svg)](https://doi.org/10.5281/zenodo.2203843) [![SWH](https://archive.softwareheritage.org/badge/swh:1:dir:a67e6dcbe3a1b5b38aad94fea4095324cd09607a/)](https://archive.softwareheritage.org/swh:1:dir:a67e6dcbe3a1b5b38aad94fea4095324cd09607a;origin=https://github.com/o2r-project/erc-checker.git;visit=swh:1:snp:e3d5cd96bdcee333417ea2192584060bef2a77ac;anchor=swh:1:rev:41e32824d581e763c58004e498c1bf1f343ef6c7;path=//) A JavaScript library and CLI tool for [ERC](https://github.com/o2r-project/erc-spec) result checking. diff --git a/codemeta.json b/codemeta.json index 6c2fd3a..032a740 100644 --- a/codemeta.json +++ b/codemeta.json @@ -3,7 +3,7 @@ "@type": "SoftwareSourceCode", "license": "https://spdx.org/licenses/Apache-2.0", "codeRepository": "git+https://github.com/o2r-project/erc-checker.git", - "contIntegration": "https://travis-ci.org/o2r-project/erc-checker", + "contIntegration": "https://github.com/o2r-project/erc-checker/actions", "dateCreated": "2019-08-16", "datePublished": "2018-08-05", "dateModified": "2020-04-24", diff --git a/docs/site_build.sh b/docs/site_build.sh deleted file mode 100755 index 9c9225f..0000000 --- a/docs/site_build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o nounset - -# Get curent commit revision -rev=$(git rev-parse --short HEAD) - -# Initialize gh-pages checkout -mkdir -p site -( - cd site - git init - git config user.name "${GH_USER_NAME}" - git config user.email "${GH_USER_EMAIL}" - git remote add upstream "https://${GH_TOKEN}@github.com/${GH_SLUG}" - git fetch upstream - git reset upstream/gh-pages -) - -# Build the documentation -mkdocs build --clean --verbose - -( - cd site - # Replace current build version and date - CURRENT_VERSION=$(git log --pretty=format:'%h' -n 1) - CURRENT_DATE=$(git show -s --format=%ci $CURRENT_VERSION) - echo $CURRENT_VERSION "@" $CURRENT_DATE - sed -i "s/@@VERSION@@/$CURRENT_VERSION/g" index.html - sed -i "s/@@TIMESTAMP@@/$CURRENT_DATE/g" index.html -) - -# Commit and push the documentation to gh-pages -( - cd site - touch . - git add -A . - git commit -m "Rebuild pages at ${rev}" - git push -q upstream HEAD:gh-pages -)