Merge pull request #2 from surya/surya-patch-1 #2
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: CI/CD Workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allows manual triggering of the workflow | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Build with Maven | |
| run: mvn compile | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Run Tests | |
| run: mvn clean test | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: surefire-reports | |
| path: target/surefire-reports/ | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: jacoco-report | |
| path: target/jacoco/coverage-reports/jacoco.xml | |
| package: | |
| name: Package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Build Package | |
| run: mvn clean package | |
| - name: Upload Package | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: packaged-app | |
| path: target/idatt2002demo-1.0-SNAPSHOT-jar-with-dependencies.jar | |
| generate-pdf: | |
| name: Generate PDF | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' # Manual trigger | |
| steps: | |
| - name: Set up Environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget fontconfig libfreetype6 libjpeg-turbo8 libpng16-16 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi xfonts-base | |
| wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb | |
| sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb | |
| sudo apt-get install -y nodejs npm git | |
| npm install -g github-wikito-converter | |
| - name: Clone Wiki | |
| run: | | |
| git clone https://github.com/${{ github.repository }}.wiki.git | |
| cd ${{ github.repository }}.wiki | |
| gwtc ${{ github.repository }} | |
| - name: Convert to PDF | |
| run: wkhtmltopdf documentation.html wiki.pdf | |
| - name: Upload PDF | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: wiki-pdf | |
| path: wiki.pdf | |
| pages: | |
| name: Publish Pages | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' # Manual trigger | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Generate Javadoc | |
| run: | | |
| mvn clean package | |
| mvn javadoc:javadoc | |
| - name: Publish to Pages | |
| uses: actions/upload-pages-artifact@v2 | |
| with: | |
| path: public |