diff --git a/.github/workflows/tests.yml b/.github/workflows/codacy.yml similarity index 64% rename from .github/workflows/tests.yml rename to .github/workflows/codacy.yml index 69663764f..1857e2e84 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/codacy.yml @@ -1,15 +1,16 @@ -name: Run tests +name: Codacy CI on: push: - branches: [main, develop] + branches: + - main pull_request: - branches: [main, develop] + branches: + - main jobs: - pytest: + build: runs-on: ubuntu-latest - services: mysql: image: mysql:5.7 @@ -23,22 +24,25 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: '3.12' - - name: Prepare environment - run: | - sed -i '/rosemary @ file:\/\/\/app/d' requirements.txt - - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - - name: Run Tests + - name: Upload coverage to Codacy + run: | + pip install codacy-coverage + coverage run -m pytest app/modules/ --ignore-glob='*selenium*' + coverage xml + python-codacy-coverage -r coverage.xml env: FLASK_ENV: testing MARIADB_HOSTNAME: 127.0.0.1 @@ -46,5 +50,4 @@ jobs: MARIADB_TEST_DATABASE: uvlhubdb_test MARIADB_USER: uvlhub_user MARIADB_PASSWORD: uvlhub_password - run: | - pytest app/modules/ --ignore-glob='*selenium*' + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml deleted file mode 100644 index 9f8c6c53b..000000000 --- a/.github/workflows/commits.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Commits Syntax Checker - -on: - pull_request: - branches: [main] - types: [opened, reopened, edited, review_requested, synchronize] - push: - branches: - - "main" - workflow_call: - -jobs: - check: - name: Conventional Commits - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: webiny/action-conventional-commits@v1.0.3 \ No newline at end of file diff --git a/.github/workflows/deloyment_on_webhook.yml b/.github/workflows/deloyment_on_webhook.yml deleted file mode 100644 index c5b9dbad0..000000000 --- a/.github/workflows/deloyment_on_webhook.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Deploy on Webhook - -on: - workflow_run: - workflows: - - "Python Lint" - - "Run tests" - types: - - completed - -jobs: - deploy: - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Check lint and test results - run: | - if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then - echo "Lint or Test workflow did not succeed. Exiting." - exit 1 - fi - - - name: Trigger Deployment Webhook - env: - WEBHOOK_DOMAIN: ${{ secrets.WEBHOOK_DOMAIN }} - WEBHOOK_TOKEN: ${{ secrets.WEBHOOK_TOKEN }} - run: | - curl -X POST https://${{ secrets.WEBHOOK_DOMAIN }}/webhook/deploy -H "Authorization: Bearer ${{ secrets.WEBHOOK_TOKEN }}" diff --git a/.github/workflows/deployment_on_dockerhub.yml b/.github/workflows/deployment_on_dockerhub.yml deleted file mode 100644 index f7dfe75eb..000000000 --- a/.github/workflows/deployment_on_dockerhub.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# GitHub recommends pinning actions to a commit SHA. -# To get a newer version, you will need to update the SHA. -# You can also reference a tag or branch, but the action may change without warning. - -name: Publish image in Docker Hub - -on: - release: - types: [published] - -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push Docker image - run: docker build --build-arg VERSION_TAG=${{ github.event.release.tag_name }} -t drorganvidez/uvlhub:${{ github.event.release.tag_name }} -f docker/images/Dockerfile.prod . - env: - DOCKER_CLI_EXPERIMENTAL: enabled - - - name: Push Docker image to Docker Hub - run: docker push drorganvidez/uvlhub:${{ github.event.release.tag_name }} - - - name: Tag and push latest - run: | - docker tag drorganvidez/uvlhub:${{ github.event.release.tag_name }} drorganvidez/uvlhub:latest - docker push drorganvidez/uvlhub:latest - env: - DOCKER_CLI_EXPERIMENTAL: enabled diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index ccbd3311b..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Python Lint - -on: - push: - branches: [main, develop] - pull_request: - branches: [main, develop] - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 - - - name: Lint with flake8 - run: | - flake8 app