Merge pull request #210 from DunklesArchipel/adopt-to-schema #1202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: { branches: [ "main" ] } | |
pull_request: { branches: [ "main" ] } | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-manual: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: { submodules: recursive } | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: { miniforge-variant: "Mambaforge" } | |
- name: install dependencies | |
shell: bash -l {0} | |
run: | | |
mamba env update --quiet -n test -f environment.yml | |
conda list | |
- name: digitize | |
shell: bash -l {0} | |
run: | | |
cd data | |
make | |
- name: install echemdb-website | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
- name: mkdocs | |
shell: bash -l {0} | |
run: | | |
# Since no browser is installed during this CI run, plotly fails to | |
# produce HTML output, see https://github.com/plotly/plotly.py/blob/2c2dd6ab2eeff73c782457f33c590c1d09a97625/packages/python/plotly/plotly/io/_renderers.py#L532 | |
export PLOTLY_RENDERER=browser | |
mkdocs build --strict | |
mv data generated/website/ | |
# Disable further processing by GitHub | |
touch generated/website/.nojekyll | |
- name: fix permissions | |
shell: bash -l {0} | |
run: | | |
# Strangely, the linkchecker modules are installed writable and linkchecker then refuses to load them. | |
chmod -R a-w `python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"` | |
- name: detect broken links | |
shell: bash -l {0} | |
run: | | |
python -m http.server 8880 --directory generated/website & | |
sleep 1 | |
# We check for broken links: | |
# * ignore fonts.gstatic.com which is mentioned by a link preconnect tag that linkchecker does not parse correctly. | |
# * ignore DOIs since some publishers ban GitHub or bots. | |
linkchecker --check-extern --no-robots --ignore fonts.gstatic.com --ignore doi.org http://localhost:8880/ --ignore mybinder.org --ignore osti.gov --no-warnings | |
# We only check links on Linux since we do not want to get flagged because of too many requests by the target websites. | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: generated/website | |
target-folder: "" | |
single-commit: true | |
if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' }} | |
- name: doctest against generated website data | |
shell: bash -l {0} | |
run: | | |
# Create a ZIP archive similar to the one automatically rovided by GitHub. | |
mkdir website-gh-pages | |
cp -R generated/website/data website-gh-pages/ | |
zip -r generated/website/website-gh-pages.zip website-gh-pages | |
# Run tests against the new ZIP archive. | |
export ECHEMDB_DATABASE_URL=http://localhost:8880/website/website-gh-pages.zip | |
pytest -n auto --doctest-plus --remote-data --doctest-modules website | |
# We only run tests on Linux since we already run tests for all OSes in the test workflow. | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
env: | |
MAKEFLAGS: -j2 |