From e318ce59ead90ff1b309fc1a00d6dd3b0bdeb660 Mon Sep 17 00:00:00 2001 From: jboilard1994 <48626957+jboilard1994@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:59:13 -0500 Subject: [PATCH] Create CI.yml --- .github/workflows/CI.yml | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..3837302 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master # Trigger the workflow for PRs targeting the master branch + +jobs: + build-and-up: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the repository + - name: Check out repository + uses: actions/checkout@v3 + + # Step 2: Set up Python + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' # Specify the Python version you need + + # Step 3: Install dependencies + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt # Install dependencies listed in requirements.txt + pip install flake8 # Install Flake8 for linting + + # Step 4: Run Flake8 for code quality checks + - name: Run Flake8 + run: | + flake8 . # Run Flake8 on the entire repository (or specify folders/files) + + # Step 5: Set up Docker + - name: Set up Docker + uses: docker/setup-docker-action@v2 + with: + version: 'latest' # Install latest version of Docker + + # Step 6: Install Docker Compose + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + docker-compose --version # Verify installation + + # Step 7: Enable Docker BuildKit + - name: Enable Docker BuildKit + run: | + echo "export DOCKER_CLI_EXPERIMENTAL=enabled" >> $GITHUB_ENV + echo "export DOCKER_BUILDKIT=1" >> $GITHUB_ENV + + # Step 8: Build Docker images from docker-compose.yaml + - name: Build images using Docker Compose + run: | + docker-compose -f ./docker-compose.yaml build + + # Step 9: Run docker-compose up with --abort-on-container-exit flag + - name: Start containers with docker-compose up + run: | + docker-compose -f ./docker-compose.yaml up --abort-on-container-exit