Skip to content

Commit

Permalink
Change working directory didn't work, so specifying the pom path.
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalazam committed Jun 21, 2023
1 parent 46ea0f0 commit 6e9ab38
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 26 deletions.
13 changes: 8 additions & 5 deletions .github/actions/generate-reports/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
UPLOADED_ARTIFACTS_DIR:
required: true
description: 'Uploads artifacts directory'
PUTTING_ALL_TOGETHER_DIR:
required: true
description: 'Directory containing the module code'

runs:
using: "composite"
Expand All @@ -22,9 +25,9 @@ runs:
path: ${{ inputs.UPLOADED_ARTIFACTS_DIR }}
- name: 'Copy the `ut` and `it` artifacts into the `target` folder'
run: |
mkdir target
cp -r ${{ env.UPLOADED_ARTIFACTS_DIR }}/${{ env.UPLOADED_ARTIFACTS_DIR }}-ut/* target
cp -rf ${{ env.UPLOADED_ARTIFACTS_DIR }}/${{ env.UPLOADED_ARTIFACTS_DIR }}-it/* target
mkdir ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target
cp -r ${{ env.UPLOADED_ARTIFACTS_DIR }}/${{ env.UPLOADED_ARTIFACTS_DIR }}-ut/* ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target
cp -rf ${{ env.UPLOADED_ARTIFACTS_DIR }}/${{ env.UPLOADED_ARTIFACTS_DIR }}-it/* ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target
shell: bash
- name: 'Cache Maven packages'
uses: actions/cache@v2
Expand All @@ -33,11 +36,11 @@ runs:
key: ${{ runner.os }}-m2-site-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-*
- name: 'Generates the project''s site'
run: mvn site -P nt --file pom.xml
run: mvn site -P nt --file ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/pom.xml
shell: bash
- name: 'Uploads the results to ${{ inputs.UPLOADED_ARTIFACTS_DIR }} folder'
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.UPLOADED_ARTIFACTS_DIR }}
retention-days: 1
path: target
path: ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target
11 changes: 7 additions & 4 deletions .github/actions/run-tests-and-upload-results/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
UPLOADED_ARTIFACTS_DIR:
required: true
description: 'Uploads artifacts directory'
PUTTING_ALL_TOGETHER_DIR:
required: true
description: 'Directory containing the module code'
RUN_UNIT_TESTS:
required: true
description: 'Run unit tests if `TRUE`, else integration tests'
Expand All @@ -21,11 +24,11 @@ runs:
JAVA_VERSION_TO_INSTALL: ${{ inputs.JAVA_VERSION_TO_INSTALL }}
- name: 'Runs the unit tests'
if: ${{ inputs.RUN_UNIT_TESTS == 'true' }}
run: mvn -Djacoco.haltOnFailure=false test -P ut --file pom.xml
run: mvn -Djacoco.haltOnFailure=false test -P ut --file ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/pom.xml
shell: bash
- name: 'Runs the integration tests'
if: ${{ inputs.RUN_UNIT_TESTS == 'false' }}
run: mvn -Djacoco.haltOnFailure=false verify -P it --file pom.xml
run: mvn -Djacoco.haltOnFailure=false verify -P it --file ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/pom.xml
shell: bash
- name: 'Set environment variables'
run: |
Expand All @@ -37,10 +40,10 @@ runs:
uses: test-summary/action@v2
with:
show: "all"
paths: "target/test-results/${{ env.FILES_DIR_PREFIX }}-tests/**/TEST-*.xml"
paths: "${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target/test-results/${{ env.FILES_DIR_PREFIX }}-tests/**/TEST-*.xml"
- name: 'Uploads the results to ${{ env.UPLOAD_DIR }} folder'
uses: actions/upload-artifact@v3
with:
name: ${{ env.UPLOAD_DIR }}
retention-days: 1
path: target
path: ${{ inputs.PUTTING_ALL_TOGETHER_DIR }}/target
34 changes: 19 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ env:
JAVA_VERSION: 20
UPLOADED_ARTIFACTS_DIR: 'gh-pages'
SITE_DIR: 'gh-pages/site'
PUTTING_ALL_TOGETHER_DIR: 'PuttingAllTogether'
BRANCHES_COVERAGE_THRESHOLD: '60%'
INSTRUCTIONS_COVERAGE_THRESHOLD: '60%'
defaults:
run:
working-directory: 'PuttingAllTogether'

jobs:
setup-env:
runs-on: ubuntu-latest
outputs:
JAVA_VERSION: ${{steps.setup-env.outputs.JAVA_VERSION}}
PUTTING_ALL_TOGETHER_DIR: ${{steps.setup-env.outputs.PUTTING_ALL_TOGETHER_DIR}}
steps:
- name: 'Setup Environment'
id: setup-env
run: |
echo "JAVA_VERSION=${{ env.JAVA_VERSION }}" >> $GITHUB_OUTPUT
echo "PUTTING_ALL_TOGETHER_DIR=${{ env.PUTTING_ALL_TOGETHER_DIR }}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
Expand All @@ -38,7 +38,7 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-*
- name: 'Compiles the application code'
run: mvn clean compile --file pom.xml
run: mvn clean compile --file ${{ env.PUTTING_ALL_TOGETHER_DIR }}/pom.xml

unit-tests:
runs-on: ubuntu-latest
Expand All @@ -52,6 +52,7 @@ jobs:
RUN_UNIT_TESTS: true
JAVA_VERSION_TO_INSTALL: ${{ env.JAVA_VERSION }}
UPLOADED_ARTIFACTS_DIR: ${{ env.UPLOADED_ARTIFACTS_DIR }}
PUTTING_ALL_TOGETHER_DIR: ${{ env.PUTTING_ALL_TOGETHER_DIR }}

integration-tests:
runs-on: ubuntu-latest
Expand All @@ -65,6 +66,7 @@ jobs:
RUN_UNIT_TESTS: false
JAVA_VERSION_TO_INSTALL: ${{ env.JAVA_VERSION }}
UPLOADED_ARTIFACTS_DIR: ${{ env.UPLOADED_ARTIFACTS_DIR }}
PUTTING_ALL_TOGETHER_DIR: ${{ env.PUTTING_ALL_TOGETHER_DIR }}

generate-project-site:
runs-on: ubuntu-latest
Expand All @@ -80,6 +82,7 @@ jobs:
with:
JAVA_VERSION_TO_INSTALL: ${{ env.JAVA_VERSION }}
UPLOADED_ARTIFACTS_DIR: ${{ env.UPLOADED_ARTIFACTS_DIR }}
PUTTING_ALL_TOGETHER_DIR: ${{ env.PUTTING_ALL_TOGETHER_DIR }}

generate-code-coverage-badge:
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down Expand Up @@ -146,14 +149,15 @@ jobs:
folder: ${{ env.SITE_DIR }}
CLEAN: true # Automatically remove deleted files from the deploy branch

deploy-to-gh-packages:
needs:
- setup-env
- unit-tests
- integration-tests
permissions:
contents: read
packages: write
uses: './.github/workflows/deploy.yml'
with:
JAVA_VERSION_TO_INSTALL: ${{ needs.setup-env.outputs.JAVA_VERSION }}
# deploy-to-gh-packages:
# needs:
# - setup-env
# - unit-tests
# - integration-tests
# permissions:
# contents: read
# packages: write
# uses: './.github/workflows/deploy.yml'
# with:
# JAVA_VERSION_TO_INSTALL: ${{ needs.setup-env.outputs.JAVA_VERSION }}
# PUTTING_ALL_TOGETHER_DIRECTORY: ${{ needs.setup-env.outputs.PUTTING_ALL_TOGETHER_DIR }}
7 changes: 5 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
JAVA_VERSION_TO_INSTALL:
required: true
type: string
PUTTING_ALL_TOGETHER_DIRECTORY:
required: true
type: string

jobs:
deploy-to-gh-packages:
Expand All @@ -23,9 +26,9 @@ jobs:
JAVA_VERSION_TO_INSTALL: ${{ inputs.JAVA_VERSION_TO_INSTALL }}

- name: 'Packaging the application'
run: mvn -DskipTests package --file pom.xml
run: mvn -DskipTests package --file ${{ inputs.PUTTING_ALL_TOGETHER_DIRECTORY }}/pom.xml

- name: 'Publishing/deploying the packaged application'
run: mvn --batch-mode -DskipTests deploy
run: mvn --batch-mode -DskipTests deploy--file ${{ inputs.PUTTING_ALL_TOGETHER_DIRECTORY }}/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6e9ab38

Please sign in to comment.