From 0f126eaf819baab43d930f191bee2906a6dd0f38 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:46:33 +0000 Subject: [PATCH 1/9] Create test.yml --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..8aed0dc8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Docker Compose Tests + +on: + push: + branches: + - githubActionTest + pull_request: + branches: + - githubActionTest + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Java 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + + - name: Run Docker Compose Tests + run: | + chmod +x ./test.sh + ./test.sh From aa34257080025ebe12e435d6cc9870a366eac721 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:52:26 +0000 Subject: [PATCH 2/9] Update test.yml --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8aed0dc8..dccfb7ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,5 +32,6 @@ jobs: - name: Run Docker Compose Tests run: | + chmod +x ./gradlew chmod +x ./test.sh ./test.sh From adc7b9606b76aff569d226945dd8434d21108490 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:53:09 +0000 Subject: [PATCH 3/9] Update test.yml --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dccfb7ff..580d584e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,20 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + + - name: Install Docker Compose run: | sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose From f3742ebeb6ee4cb208aa302aba0aded766ff92a6 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:53:21 +0000 Subject: [PATCH 4/9] Update test.yml --- .github/workflows/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 580d584e..2003199a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,11 +39,6 @@ jobs: sudo chmod +x /usr/local/bin/docker-compose - - name: Install Docker Compose - run: | - sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - - name: Run Docker Compose Tests run: | chmod +x ./gradlew From b1f80bc9f661e22721dee5f1801cbda42944ba0e Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 1 Jan 2024 20:07:37 +0000 Subject: [PATCH 5/9] Update test.yml --- .github/workflows/test.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2003199a..8c9b48ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,11 +25,20 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Run Docker Compose Tests + run: | + chmod +x ./gradlew + + - name: Get version number + id: versionNumber + run: echo "::set-output name=versionNumber::$(./gradlew printVersion --quiet | tail -1)" + + - name: Cache Docker layers uses: actions/cache@v2 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} + key: ${{ runner.os }}-buildx-${{ steps.versionNumber.outputs.versionNumber }} restore-keys: | ${{ runner.os }}-buildx- @@ -41,6 +50,5 @@ jobs: - name: Run Docker Compose Tests run: | - chmod +x ./gradlew chmod +x ./test.sh ./test.sh From 468808167c31a59008ce1cbf4275cdd1c9a0beca Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:54:33 +0000 Subject: [PATCH 6/9] Update test.yml --- .github/workflows/test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c9b48ae..97ca64e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,9 +5,14 @@ on: branches: - githubActionTest pull_request: - branches: - - githubActionTest - + paths: + - 'src/**' + - '**.gradle' + - 'exampleYmlFiles/**' + - 'Dockerfile' + - 'Dockerfile**' # If you have Dockerfiles in a docker directory + paths-ignore: + - 'src/main/java/resources/messages*' jobs: test: runs-on: ubuntu-latest From e0d79990c805d21dde961eca936a2498535b9136 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Tue, 2 Jan 2024 21:10:11 +0000 Subject: [PATCH 7/9] Update test.yml --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97ca64e5..03290bbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,6 @@ name: Docker Compose Tests on: - push: - branches: - - githubActionTest pull_request: paths: - 'src/**' From 31fbeaae1d512635aab10305042d90198b7be801 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Tue, 2 Jan 2024 21:11:05 +0000 Subject: [PATCH 8/9] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03290bbd..b131a6df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: - '**.gradle' - 'exampleYmlFiles/**' - 'Dockerfile' - - 'Dockerfile**' # If you have Dockerfiles in a docker directory + - 'Dockerfile**' paths-ignore: - 'src/main/java/resources/messages*' jobs: From 56a18672700c001265ccbb41b392e6eb58b279cc Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Tue, 2 Jan 2024 21:17:25 +0000 Subject: [PATCH 9/9] Update test.sh --- test.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index cf03796c..beb610a0 100644 --- a/test.sh +++ b/test.sh @@ -69,7 +69,12 @@ main() { SECONDS=0 export DOCKER_ENABLE_SECURITY=false - ./gradlew clean build + # Run the gradlew build command and check if it fails + if ! ./gradlew clean build; then + echo "Gradle build failed with security disabled, exiting script." + exit 1 + fi + # Building Docker images docker build --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile . @@ -82,7 +87,12 @@ main() { run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml" export DOCKER_ENABLE_SECURITY=true - ./gradlew clean build + # Run the gradlew build command and check if it fails + if ! ./gradlew clean build; then + echo "Gradle build failed with security enabled, exiting script." + exit 1 + fi + # Building Docker images with security enabled docker build --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile .