Skip to content

Commit

Permalink
chore(CI): add build CI and documentation CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexismanin committed Jan 15, 2025
1 parent 1753d52 commit bea0567
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Uses Gradle actions to build project.
# For details, see: https://github.com/gradle/actions
name: Build and test project

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

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
architecture: 'x64'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build and test
run: ./gradlew build -Pmaven_settings_location='undefined'
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: Application
path: build/libs/crs-service.jar
- name: Upload test reports
uses: actions/upload-artifact@v4
with:
name: Test reports
path: |
build/test-results
build/reports/tests
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
architecture: 'x64'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
with:
additional-arguments: "-Pmaven_settings_location='undefined'"
54 changes: 54 additions & 0 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Compile and publish documentation

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

jobs:
compile-doc:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
architecture: 'x64'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Compile documentation
run: ./gradlew asciidoc -Pmaven_settings_location='undefined'
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: project-documentation
path: build/docs/asciidoc

publish-doc:
needs: compile-doc
# Only publish documentation from main branch
if: github.ref == 'refs/heads/main'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: 'project-documentation'

0 comments on commit bea0567

Please sign in to comment.