Skip to content

Commit

Permalink
Merge branch 'master' into B4nner
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyPex committed Jul 18, 2024
2 parents 45c280b + 5070dfe commit bc46127
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ else
then
echo "[!] - ERROR : The specified Argument $1 is not a directory"
exit 1
else
ls -lA $1 | grep -qo docker-compose.yml
elif (ls -lA $1 | grep -qo docker-compose.yml)
then
echo "::set-output name=deploy_env::docker-compose"
elif (ls -lA $1 | grep -qo Dockerfile)
echo "::set-output name=deploy_env::Dockerfile"
fi
fi
21 changes: 0 additions & 21 deletions .github/scripts/dockerfile_checker.sh

This file was deleted.

46 changes: 17 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ jobs:
- name: Test Challenge directory structure
run: .github/scripts/chall_structure_validator.py ${{github.head_ref}}

test_dockerfile:
test_deployability:
name: 'Check Dockerfile Existance'
defaults:
run:
shell: bash
outputs:
deploy_env: ${{ steps.deployable.outputs.deploy_env }}
runs-on: ubuntu-latest
needs: test
if: success()
Expand All @@ -41,34 +43,17 @@ jobs:
ref: ${{ github.head_ref }}

- name: 'Dockerfile Existance'
run : .github/scripts/dockerfile_checker.sh ${{ github.head_ref }}


test_docker_compose:
name: 'Check Docker Compose Existance'
defaults:
run:
shell: bash
runs-on: ubuntu-latest
needs: test
if: success()
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: 'Docker Compose Existance'
run : .github/scripts/docker_compose_checker.sh ${{ github.head_ref }}
id: 'deployable'
run : .github/scripts/deployability_checker.sh ${{ github.head_ref }}

build_dockerfile:
name: 'Build Challenge Container using Dockerfile'
defaults:
run:
shell: bash
runs-on: ubuntu-latest
needs: test_dockerfile
if: success()
needs: test_deployability
if: ${{needs.test_deployability.outputs.deploy_env}} == 'Dockerfile'
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -78,11 +63,14 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
tags: ${{github.head_ref}}:latest
- name: Build Challenge Image
run: docker buildx ./${{github.head_ref}}/ -t ${{github.head_ref}}:latest

- name: Launch Container
run: docker run -d ${{github.head_ref}}:latest

- name: Check Running Container
run: docker ps -a


build_docker-compose:
Expand All @@ -91,8 +79,8 @@ jobs:
run:
shell: bash
runs-on: ubuntu-latest
needs: test_docker_compose
if: success()
needs: test_deployability
if: ${{needs.test_deployability.outputs.deploy_env}} == 'docker-compose'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit bc46127

Please sign in to comment.