Skip to content

Commit

Permalink
Update CI and switch to documentation tables based on xcore
Browse files Browse the repository at this point in the history
- CI runs on push/pull_request to branches as defined in #435
- Generation of documentation tables is now based on xcore
- Documentation tables are generated for all those branches and uploaded to according subdirectories in GitHub pages
- Documentation tables are no longer stored in the repository itself
  • Loading branch information
sgrossberndt committed Mar 15, 2024
1 parent e43697a commit 8a04b3e
Show file tree
Hide file tree
Showing 47 changed files with 7,290 additions and 4,380 deletions.
62 changes: 49 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,84 @@
name: CI

on:
# Triggers the workflow on push or pull request events but only for the "master" branch
# Triggers the workflow on push and pull request events for specific branches
push:
branches: [ "master", "main", "changes_for_v*" ]
branches:
- main
- develop
- 'release/**'
- 'feature/**'
- 'bugfix/**'
pull_request:
branches: [ "master", "main", "changes_for_v*" ]
branches:
- main
- develop
- 'release/**'
- 'feature/**'
- 'bugfix/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# required to upload to GitHub pages
permissions:
contents: write

jobs:
run:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest

steps:
- run: echo "Job was automatically triggered by a ${{ github.event_name }} event for branch ${{ github.ref }}"

- name: Check out repository code
uses: actions/checkout@v3
- name: Check out repository code for push
if: github.event_name == 'push' # only if this is a push to a branch
uses: actions/checkout@v4

- name: Check out repository code for pull_request
if: github.event_name == 'pull_request' # only if this is a pull_request to a branch
uses: actions/checkout@v4
with:
# https://github.com/marketplace/actions/add-commit#working-with-prs
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Install xmllint and xsltproc
- name: Install java, xmllint and xsltproc
run: |
sudo apt-get update
sudo apt-get install libxml2-utils xsltproc
sudo apt-get install default-jre libxml2-utils xsltproc
- name: Validate structure and lint XSD and XML files
run: ./.github/scripts/validate-and-lint.sh

- name: Validate OJP XML examples
run: ./.github/scripts/validate-examples.sh

- name: Check schema structure for generation for documentation tables
run: ./docs/validate-schema-conventions.sh

- name: Generate documentation tables
run: ./docs/generate-tables.sh

- name: Get branch name
id: get-branch-name
# Done as an extra step because ${{ github.ref }} has "refs/heads/" prepended and there is no operation on GitHub strings possible
# https://github.com/orgs/community/discussions/26625
if: github.event_name == 'push' # only if this is a push to a branch
# cut -d/ -f3,4 splits the ${{ github.ref }} using "/" and returns 3rd and optional 4th position
run: |
BRANCH_NAME=$(echo ${{ github.ref }} | cut -d/ -f3,4)
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Upload generated documentation tables
if: github.event_name == 'push' # only if this is a push to a branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: './docs/generated'
target-folder: "${{steps.get-branch-name.outputs.BRANCH_NAME}}"

- name: Remove generated documentation tables
run: rm -rf ./docs/generated/documentation-tables

- name: Commit changes
uses: EndBug/add-and-commit@v9 # https://github.com/marketplace/actions/add-commit
with:
default_author: github_actions
message: 'Lint and update documentation tables'
message: 'fixup! Fixed linting errors'
push: --set-upstream origin "${{steps.get-branch-name.outputs.BRANCH_NAME}}"
38 changes: 0 additions & 38 deletions .github/workflows/deploy-pages.yml

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 8a04b3e

Please sign in to comment.