From 67fb9df1c8dad13c74be6465573ef1264c5096e1 Mon Sep 17 00:00:00 2001 From: Mx-Bx <88007614+Mx-Bx@users.noreply.github.com> Date: Sat, 13 Jul 2024 05:41:41 +0000 Subject: [PATCH] Create main workflow --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b42254c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: dit-devops-project + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Lint with flake8 + run: | + pip install flake8 + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Test with pytest + run: | + pip install pytest + pytest + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Login to dockerhub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push to dockerhub + uses: docker/build-push-action@v5 + with: + context: + push: true + tags: barryma22/dit-devops-project:latest