Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Refactor CI. (#41)
Browse files Browse the repository at this point in the history
* Refactor CI.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add shell: bash

* Reusable workflows?

* Simplify?

* Rename steps?

* Old names but without needs

* Descriptions trip it up.

* Refactor push-main too

* Nicer names of two main workflows

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PeterKraus and pre-commit-ci[bot] authored Nov 2, 2023
1 parent 43d88c6 commit 9c8644c
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 133 deletions.
45 changes: 18 additions & 27 deletions .github/workflows/deploy.yml → .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
name: CI docs

name: Build docs
on:
push:
branches:
- main
workflow_call:

jobs:
build-pages:
build-docs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -23,25 +20,40 @@ jobs:
requirements*.txt
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-docs.txt
- name: Check environment
shell: bash
run: |
pip freeze
- name: Build base docs
shell: bash
run: |
gen-doc schemas/base.yaml -d docs/source/gen-doc --template-directory docs/source/_templates
- name: Build FileType docs
shell: bash
run: |
gen-doc schemas/filetype.yml -d docs/source/gen-doc --template-directory docs/source/_templates
- name: Build Extractor docs
shell: bash
run: |
gen-doc schemas/extractor.yml -d docs/source/gen-doc --template-directory docs/source/_templates
- name: Upload gen-doc artifact
uses: actions/upload-artifact@v3
with:
name: gen-doc
path: docs/source/gen-doc

- name: Build Sphinx docs
shell: bash
run: |
sphinx-build -b html docs/source public/main
Expand All @@ -50,24 +62,3 @@ jobs:
with:
name: public-main
path: public/main
deploy-pages:
runs-on: ubuntu-latest
needs:
- build-pages
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/download-artifact@v3
with:
name: public-main
path: public/main

- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true
51 changes: 51 additions & 0 deletions .github/workflows/check-linkml-schemas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Check LinkML schemas
on:
workflow_call:

jobs:
check-linkml-schemas:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip
cache-dependency-path: |
requirements*.txt
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -r requirements.txt
- name: Check environment
shell: bash
run: |
pip freeze
- name: Run LinkML generators
shell: bash
run: |
for f in $(ls schemas/*); do
gen-pydantic -vvv --stacktrace $f
gen-json-schema -vvv --stacktrace $f
done
- name: Validate examples
shell: bash
run: |
for f in $(ls examples/extractor/*.yml); do
linkml-validate -s schemas/extractor.yml -C Extractor $f
done
for f in $(ls examples/filetype/*.yml); do
linkml-validate -s schemas/filetype.yml -C FileType $f
done
106 changes: 0 additions & 106 deletions .github/workflows/ci.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: CI PR

on:
pull_request:
branches:
- main

# Cancel running workflows when additional changes are pushed
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:

call-check-linkml-schemas:
uses: ./.github/workflows/check-linkml-schemas.yml

call-build-docs:
needs: [call-check-linkml-schemas]
uses: ./.github/workflows/build-docs.yml
39 changes: 39 additions & 0 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: CI main

on:
push:
branches:
- main


jobs:

call-check-linkml-schemas:
uses: ./.github/workflows/check-linkml-schemas.yml

call-build-docs:
needs: [call-check-linkml-schemas]
uses: ./.github/workflows/build-docs.yml

deploy-pages:
runs-on: ubuntu-latest
needs: [call-build-docs]
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/download-artifact@v3
with:
name: public-main
path: public/main

- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true

0 comments on commit 9c8644c

Please sign in to comment.