Skip to content

Commit

Permalink
Add github pages documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
phavekes committed Oct 3, 2023
1 parent 4d78faf commit 310d874
Show file tree
Hide file tree
Showing 15 changed files with 1,182 additions and 163 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

version: 2
updates:
- package-ecosystem: npm
Expand Down
74 changes: 37 additions & 37 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
---
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Yarn Audit client
run: yarn audit --level high --groups dependencies
working-directory: client
- name: Yarn Audit welcome
run: yarn audit --level high --groups dependencies
working-directory: welcome
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: Set up MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
- run: |
mysql -uroot -h127.0.0.1 -e \
"CREATE DATABASE access CHARACTER SET utf8mb4 \
COLLATE utf8mb4_0900_ai_ci;"
- run: |
mysql -uroot -h127.0.0.1 -e \
"CREATE USER 'access'@'localhost' IDENTIFIED BY 'secret';";
- run: |
mysql -uroot -h127.0.0.1 -e \
"GRANT ALL privileges ON access.* TO 'access'@'localhost';"
- name: Build with Maven
run: mvn clean install --file pom.xml
- name: Codecov
uses: codecov/[email protected]
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Yarn Audit client
run: yarn audit --level high --groups dependencies
working-directory: client
- name: Yarn Audit welcome
run: yarn audit --level high --groups dependencies
working-directory: welcome
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: Set up MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
- run: |
mysql -uroot -h127.0.0.1 -e \
"CREATE DATABASE access CHARACTER SET utf8mb4 \
COLLATE utf8mb4_0900_ai_ci;"
- run: |
mysql -uroot -h127.0.0.1 -e \
"CREATE USER 'access'@'localhost' IDENTIFIED BY 'secret';";
- run: |
mysql -uroot -h127.0.0.1 -e \
"GRANT ALL privileges ON access.* TO 'access'@'localhost';"
- name: Build with Maven
run: mvn clean install --file pom.xml
- name: Codecov
uses: codecov/[email protected]
218 changes: 110 additions & 108 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

name: Maven install

on:
Expand All @@ -14,111 +16,111 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7
- name: Set up cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Determine the version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
id: versioncheck

- name: Exit when workflow_dispatch is triggered, and the version does not contain SNAPSHOT in it's name
run: |
echo "Only SNAPSHOT releases can be triggered with the workflow_dispatch"
exit 1
if: github.event_name == 'workflow_dispatch' && ( !endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))

- name: Exit when a production build is triggered, and the github tag is not the same as the version in pom.xml
run: |
echo echo "Project version ${{ steps.versioncheck.outputs.version }} does not match git tag ${{ github.ref_name }}"
exit 1
if: github.event_name != 'workflow_dispatch' && steps.versioncheck.outputs.version != github.ref_name
- name: Set up JDK 17 for snapshots
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: openconext-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
if: ( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))
- name: Set up JDK 17 for releases
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: openconext-releases
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
if: ${{!( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT')) }}

- name: Deploy with Maven
run: mvn --batch-mode deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.BUILD_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.BUILD_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the server image
uses: docker/build-push-action@v4
with:
context: server
file: server/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteserver:${{ steps.versioncheck.outputs.version }}
- name: Build and push the client image
uses: docker/build-push-action@v4
with:
context: client
file: client/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteclient:${{ steps.versioncheck.outputs.version }}
- name: Build and push the welcome image
uses: docker/build-push-action@v4
with:
context: welcome
file: welcome/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/invitewelcome:${{ steps.versioncheck.outputs.version }}
- name: Build and push the provisioning mock image
uses: docker/build-push-action@v4
with:
context: provisioning-mock
file: provisioning-mock/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteprovisioningmock:${{ steps.versioncheck.outputs.version }}
- uses: actions/checkout@v2

- name: Setup Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7

- name: Set up cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Determine the version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
id: versioncheck

- name: Exit when workflow_dispatch is triggered, and the version does not contain SNAPSHOT in it's name
run: |
echo "Only SNAPSHOT releases can be triggered with the workflow_dispatch"
exit 1
if: github.event_name == 'workflow_dispatch' && ( !endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))

- name: Exit when a production build is triggered, and the github tag is not the same as the version in pom.xml
run: |
echo echo "Project version ${{ steps.versioncheck.outputs.version }} does not match git tag ${{ github.ref_name }}"
exit 1
if: github.event_name != 'workflow_dispatch' && steps.versioncheck.outputs.version != github.ref_name

- name: Set up JDK 17 for snapshots
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: openconext-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
if: ( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT'))

- name: Set up JDK 17 for releases
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: openconext-releases
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
if: ${{!( endsWith(steps.versioncheck.outputs.version, '-SNAPSHOT')) }}

- name: Deploy with Maven
run: mvn --batch-mode deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.BUILD_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.BUILD_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the server image
uses: docker/build-push-action@v4
with:
context: server
file: server/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteserver:${{ steps.versioncheck.outputs.version }}
- name: Build and push the client image
uses: docker/build-push-action@v4
with:
context: client
file: client/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteclient:${{ steps.versioncheck.outputs.version }}
- name: Build and push the welcome image
uses: docker/build-push-action@v4
with:
context: welcome
file: welcome/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/invitewelcome:${{ steps.versioncheck.outputs.version }}
- name: Build and push the provisioning mock image
uses: docker/build-push-action@v4
with:
context: provisioning-mock
file: provisioning-mock/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-invite/inviteprovisioningmock:${{ steps.versioncheck.outputs.version }}
68 changes: 68 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: make-doc

# Triggers the workflow on push or pull request events
on: [push, pull_request] # yamllint disable-line

jobs:
test-redoc:
runs-on: ubuntu-latest
name: Test documentation and generate openapi html documentation
steps:
- name: Checkout
uses: actions/checkout@v3

- name: lint markdown files
uses: nosborn/[email protected]
with:
files: .

- name: lint yaml files
uses: ibiqlik/action-yamllint@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: Set up MySQL
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
- name: Prepare database
run: |
mysql -uroot -h127.0.0.1 -e \
"CREATE DATABASE access CHARACTER SET utf8mb4 \
COLLATE utf8mb4_0900_ai_ci;"
mysql -uroot -h127.0.0.1 -e \
"CREATE USER 'access'@'localhost' IDENTIFIED BY 'secret';";
mysql -uroot -h127.0.0.1 -e \
"GRANT ALL privileges ON access.* TO 'access'@'localhost';"
- name: Generate openapi.json
run: mvn verify -DskipTests=true

- name: Test api-specs with redoc-cli
uses: seeebiii/redoc-cli-github-action@v10
with:
args: 'bundle server/target/openapi.json -t template.hbs -o docs/api/index.html'

- name: check result
run: |
ls -al docs/api/
test -f docs/api/index.html || (echo "Missing docs/api/index.html from previous step." && exit 1)
- name: Commit files if the html has changed
run: |
git config user.name github-actions
git config user.email [email protected]
git pull
git add docs/api/index.html
git diff-index --quiet HEAD || git commit -m "Update github page"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
Loading

0 comments on commit 310d874

Please sign in to comment.