Skip to content

Commit

Permalink
ci: Flakey build. coreweb yarn install Bus Error core (#29415) (#29424)
Browse files Browse the repository at this point in the history
Related to #29415 (Flakey build. coreweb yarn install Bus Error core ).
- Modifies and fixes caching of yarn and maven in mavan-job github
action
- Adds maven target folder to .nxignore as projects are picked up from
there after build
- Updates commit hook to handle more cases and only run frontend fixes
when there are frontend changes
  • Loading branch information
spbolton authored Aug 2, 2024
1 parent e346265 commit 821da8d
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 153 deletions.
42 changes: 24 additions & 18 deletions .github/actions/maven-job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,43 +99,49 @@ runs:
echo "${DOTCMS_LICENSE_KEY}" > ${DOTCMS_LICENSE_PATH}/license.dat
echo "DOTCMS_LICENSE_FILE=${DOTCMS_LICENSE_PATH}/license.dat" >> "$GITHUB_ENV"
- id: get-maven-month-key
name: Get Maven Month Cache Key
shell: bash
run: |
echo "month-key=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT
- id: restore-cache-maven
name: Restore Maven Repository Cache
if: ${{ inputs.artifacts-from == '' }}
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mavencore-${{ steps.get-maven-month-key.outputs.month-key }}
key: ${{ runner.os }}-mavencore-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mavencore-
- id: restore-cache-node
name: Restore Node Binary Cache
if: ${{ inputs.requires-node == 'true' }}
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: installs
key: node-binary-${{ hashFiles('core-web/.nvmrc') }}

- name: Get yarn cache directory path
id: yarn-info
if: ${{ inputs.requires-node == 'true' }}
shell: bash
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "version=$(yarn -v)" >> $GITHUB_OUTPUT
- id: restore-cache-yarn
name: Restore Yarn Cache
if: ${{ inputs.requires-node == 'true' }}
uses: actions/cache/restore@v4
with:
path: ~/.cache/yarn
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-
path: ${{ steps.yarn-info.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ steps.yarn-info.outputs.version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ steps.yarn-info.outputs.version }}
${{ runner.os }}-yarn-
- id: cache-sonar
name: Cache SonarQube Packages
if: ${{ inputs.cache-sonar == 'true' }}
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
Expand Down Expand Up @@ -177,7 +183,7 @@ runs:
name: Run Maven Build
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: |
DEFAULT_ARGS="-e -B --no-transfer-progress --show-version -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Pprod"
DEFAULT_ARGS="-e -B --no-transfer-progress --show-version -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dprod=true"
MAVEN_ARGS="${{ inputs.maven-args }}"
if [[ "${{ inputs.generate-docker }}" == "true" ]]; then
DEFAULT_ARGS="$DEFAULT_ARGS -Ddocker.buildArchiveOnly=dotCMS/target"
Expand Down Expand Up @@ -250,31 +256,31 @@ runs:
uses: actions/cache/save@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mavencore-${{ steps.get-maven-month-key.outputs.month-key }}
key: ${{ steps.restore-cache-maven.outputs.cache-primary-key }}

- id: save-cache-node
name: Save Node Binary Cache
if: ${{ inputs.generate-artifacts == 'true' && steps.restore-cache-node.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: installs
key: node-binary-${{ hashFiles('core-web/.nvmrc') }}
key: ${{ steps.restore-cache-node.outputs.cache-primary-key }}

- id: save-cache-yarn
name: Save Yarn Cache
if: ${{ inputs.generate-artifacts == 'true' && steps.restore-cache-yarn.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ~/.cache/yarn
key: yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-info.outputs.dir }}
key: ${{ steps.restore-cache-yarn.outputs.cache-primary-key }}

- id: save-cache-sonar
name: Save SonarQube Cache
if: ${{ inputs.cache-sonar == 'true' && steps.cache-sonar.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
key: ${{ steps.cache-sonar.outputs.cache-primary-key }}

# ---------------------------- Generate Reports Artifacts ----------------------------
- id: generate-build-reports-artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- uses: ./.github/actions/maven-job
with:
stage-name: "Initial Artifact Build"
maven-args: "clean install ${{ env.VALIDATE_PROFILE }} -DskipTests=true -Dgithub.event.name=${{ github.event_name }}"
maven-args: "clean install ${{ env.VALIDATE_PROFILE }} -Dprod=true -DskipTests=true -Dgithub.event.name=${{ github.event_name }}"
generate-artifacts: true
require-master: ${{ inputs.version == '1.0.0-SNAPSHOT' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
maven-args: "-Pcoverage verify -pl :dotcms-postman -Dpostman.test.skip=false -Dpostman.collections=${{ matrix.collection_group }}"
generates-test-results: true
dotcms-license: ${{ secrets.DOTCMS_LICENSE }}
requires-node: false
requires-node: true
needs-docker-image: true
github-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-from: ${{ env.ARTIFACT_RUN_ID }}
Loading

0 comments on commit 821da8d

Please sign in to comment.