diff --git a/.github/workflows/self-hosted-build.yml b/.github/workflows/self-hosted-build.yml new file mode 100644 index 00000000000..1f5b4f2c90d --- /dev/null +++ b/.github/workflows/self-hosted-build.yml @@ -0,0 +1,62 @@ +name: Maven Cache Preload + +on: + push: + paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE', 'microservices/**'] + branches: + - 'integration' + - 'release/version*' + pull_request: + paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE', 'microservices/**'] + workflow_dispatch: + schedule: + - cron: "0 8,12 * * 1-5" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + JAVA_VERSION: '11' + JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8 + MAVEN_OPTS: "-Djansi.force=true -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true -XX:ThreadStackSize=1m -Daether.connector.basic.threads=8 -Daether.metadataResolver.threads=8 -Daether.syncContext.named.time=480" + GITHUB_REGISTRY: ghcr.io + GITHUB_USERNAME: ${{ secrets.GHCR_WRITE_USER_NAME }} + GITHUB_PASSWORD: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }} + +jobs: + # Runs the pom sorter and code formatter to ensure that the code + # is formatted and poms are sorted according to project rules. If changes are found, + # they are committed back to the branch + + # Build the code and run the unit tests. + build-and-load-maven-cache: + runs-on: self-hosted + continue-on-error: true + steps: + - name: Checkout Code + uses: actions/checkout@v4 + # Clean up free space + - uses: ./.github/actions/free-space + with: + tool-cache: false + - name: Set up JDK ${{env.JAVA_VERSION}} + uses: actions/setup-java@v4 + with: + distribution: ${{env.JAVA_DISTRIBUTION}} + java-version: ${{env.JAVA_VERSION}} + cache: 'maven' + server-id: github-datawave + # username and password are the env variables names that maven will use + server-username: GITHUB_USERNAME + server-password: GITHUB_PASSWORD + - name: Build and Run Unit Tests + run: | + export M2_HOME=/opt/apache-maven-3.9.11/ + export M2=$M2_HOME/bin + export PATH=$M2:$PATH + + mvn --show-version --batch-mode --errors --no-transfer-progress "-Dstyle.color=always" -Pexamples,assemble,spotbugs -Dmaven.build.cache.enabled=true -Dmaven.build.cache.remote.enabled=true -Dmaven.build.cache.remote.save.enabled=true -Ddeploy -Ddist -T1C clean install -Dsurefire.rerunFailingTestsCount=3 -Dutils -Dservices -Dstarters -DskipITs -DskipFormat + + +