-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PR and Main build workflows (#199)
Fix Issue galasa-dev/projectmanagement#1941
- Loading branch information
Showing
4 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Main Build | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
NAMESPACE: galasa-dev | ||
|
||
jobs: | ||
build-integrationtests: | ||
name: Building the Integration Tests Repository | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'semeru' | ||
cache: maven | ||
|
||
- name: Print githash | ||
run: | | ||
echo $GITHUB_SHA > ./inttests.githash | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
gradle-version: 6.9.2 | ||
|
||
- name: Build Integration Tests Gradle source code | ||
run: | | ||
gradle -b galasa-inttests-parent/build.gradle publish publishToMavenLocal \ | ||
-PsourceMaven=https://development.galasa.dev/gh/maven-repo/obr \ | ||
-PcentralMaven=https://repo.maven.apache.org/maven2/ \ | ||
-PtargetMaven=${{github.workspace}}/repo | ||
- name: Building Integration Tests Maven source code | ||
run: | | ||
mvn -f galasa-inttests-parent/dev.galasa.inttests.obr/pom.xml deploy \ | ||
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \ | ||
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ | ||
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \ | ||
-Dgalasa.skip.deploytestcatalog=true \ | ||
-Dgalasa.skip.bundletestcatalog=false \ | ||
--batch-mode --errors --fail-at-end \ | ||
--settings ${{github.workspace}}/settings.xml | ||
- name: Login to Github Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata for Integration Tests image | ||
id: metadata | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/inttests-maven-artefacts | ||
|
||
- name: Build Integration Tests image for development Maven registry | ||
id: build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: dockerfiles/dockerfile.inttests | ||
push: true | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.labels }} | ||
build-args: | | ||
baseVersion=latest | ||
dockerRepository=ghcr.io | ||
branch=main | ||
- name: Recycle application in ArgoCD | ||
env: | ||
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }} | ||
run: | | ||
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app actions run gh-maven-repos restart --kind Deployment --resource-name inttests-gh --server argocd.galasa.dev | ||
- name: Wait for app health in ArgoCD | ||
env: | ||
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }} | ||
run: | | ||
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait gh-maven-repos --resource apps:Deployment:inttests-gh --health --server argocd.galasa.dev | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: PR Build | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build-integrationtests: | ||
name: Building the Integration Tests Repository | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'semeru' | ||
cache: maven | ||
|
||
- name: Print githash | ||
run: | | ||
echo $GITHUB_SHA > ./inttests.githash | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
gradle-version: 6.9.2 | ||
|
||
- name: Build Integration Tests Gradle source code | ||
run: | | ||
gradle -b galasa-inttests-parent/build.gradle publish publishToMavenLocal \ | ||
-PsourceMaven=https://development.galasa.dev/gh/maven-repo/obr \ | ||
-PcentralMaven=https://repo.maven.apache.org/maven2/ \ | ||
-PtargetMaven=${{github.workspace}}/repo | ||
- name: Building Integration Tests Maven source code | ||
run: | | ||
mvn -f galasa-inttests-parent/dev.galasa.inttests.obr/pom.xml deploy -Dgpg.skip=true \ | ||
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \ | ||
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ | ||
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \ | ||
-Dgalasa.skip.deploytestcatalog=true \ | ||
-Dgalasa.skip.bundletestcatalog=false \ | ||
--batch-mode --errors --fail-at-end \ | ||
--settings ${{github.workspace}}/settings.xml | ||
- name: Build Integration Tests image for testing | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: dockerfiles/dockerfile.inttests | ||
load: true | ||
tags: intests:test | ||
build-args: | | ||
baseVersion=latest | ||
dockerRepository=ghcr.io | ||
branch=main | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG baseVersion | ||
ARG dockerRepository | ||
FROM ${dockerRepository}/galasa-dev/base-image:${baseVersion} | ||
|
||
ARG branch | ||
|
||
RUN sed -i "s/--branchname--/${branch}/" /usr/local/apache2/conf/httpd.conf | ||
RUN sed -i 's/--repositoryname--/inttests/' /usr/local/apache2/conf/httpd.conf | ||
|
||
COPY repo/ /usr/local/apache2/htdocs/ | ||
COPY inttests.githash /usr/local/apache2/htdocs/inttests.githash |
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