mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-03-20 00:17:10 +01:00
Merge pull request #643 from Stirling-Tools/githubActionTest
GitHub action for docker testing
This commit is contained in:
commit
fbe0a8ddcc
56
.github/workflows/test.yml
vendored
Normal file
56
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: Docker Compose Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- '**.gradle'
|
||||||
|
- 'exampleYmlFiles/**'
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'Dockerfile**'
|
||||||
|
paths-ignore:
|
||||||
|
- 'src/main/java/resources/messages*'
|
||||||
|
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: 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-${{ steps.versionNumber.outputs.versionNumber }}
|
||||||
|
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: Run Docker Compose Tests
|
||||||
|
run: |
|
||||||
|
chmod +x ./test.sh
|
||||||
|
./test.sh
|
14
test.sh
14
test.sh
@ -69,7 +69,12 @@ main() {
|
|||||||
SECONDS=0
|
SECONDS=0
|
||||||
|
|
||||||
export DOCKER_ENABLE_SECURITY=false
|
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
|
# Building Docker images
|
||||||
docker build --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile .
|
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"
|
run_tests "Stirling-PDF" "./exampleYmlFiles/docker-compose-latest.yml"
|
||||||
|
|
||||||
export DOCKER_ENABLE_SECURITY=true
|
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
|
# Building Docker images with security enabled
|
||||||
docker build --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile .
|
docker build --build-arg VERSION_TAG=alpha -t frooodle/s-pdf:latest -f ./Dockerfile .
|
||||||
|
Loading…
Reference in New Issue
Block a user