From 09312734f5639124324de3667187a33f362a8923 Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:41:12 +0200 Subject: [PATCH 1/6] w --- .github/workflows/deployment-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment-backend.yml b/.github/workflows/deployment-backend.yml index d3a6527b..76318783 100644 --- a/.github/workflows/deployment-backend.yml +++ b/.github/workflows/deployment-backend.yml @@ -1,4 +1,4 @@ -name: Docker Deployment Test +name: Docker Deployment Test a on: pull_request: From e58da5520f694b349df4822dbe50101fbf72307e Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:45:02 +0200 Subject: [PATCH 2/6] a --- .../workflows/backend-tests-database-blob.yml | 43 ------------------- ...nd-tests-streaming-serverless-function.yml | 43 ------------------- .github/workflows/deployment-backend.yml | 31 +++++++++++-- .github/workflows/eslintrc-check.yml | 26 ----------- .github/workflows/frontend-style-prettier.yml | 26 ----------- .github/workflows/frontend-tests.yml | 27 ------------ .github/workflows/generate-docs.yml | 29 ------------- .github/workflows/ruff-format-check.yml | 14 ------ .github/workflows/ruff-lint-check.yml | 12 ------ 9 files changed, 28 insertions(+), 223 deletions(-) delete mode 100644 .github/workflows/backend-tests-database-blob.yml delete mode 100644 .github/workflows/backend-tests-streaming-serverless-function.yml delete mode 100644 .github/workflows/eslintrc-check.yml delete mode 100644 .github/workflows/frontend-style-prettier.yml delete mode 100644 .github/workflows/frontend-tests.yml delete mode 100644 .github/workflows/generate-docs.yml delete mode 100644 .github/workflows/ruff-format-check.yml delete mode 100644 .github/workflows/ruff-lint-check.yml diff --git a/.github/workflows/backend-tests-database-blob.yml b/.github/workflows/backend-tests-database-blob.yml deleted file mode 100644 index e691fa3d..00000000 --- a/.github/workflows/backend-tests-database-blob.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: A Backend Tests - Database Blob - -on: - pull_request: - branches: - - 'master' - - 'master-*' - -jobs: - run_tests_blob_architecture: - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: "3.11" - architecture: "x64" - env: - AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache - - - name: Install dependencies - working-directory: Backend - run: | - pip install -r requirements.txt - pip install -r requirements-test.txt - - - name: Run tests Database Blob Architecture - working-directory: Backend/ - run: | - python -m pytest tests/ - env: - MONGO_URI: mongodb://root:root@localhost:27017/ - SECRET_KEY_SIGN: ${{ secrets.SECRET_KEY_SIGN }} - SERVERLESS_FUNCTION_URL: ${{ secrets.SERVERLESS_FUNCTION_URL }} - ARCH: "BLOB" - ENV_VALUE: "PROD" - - - name: Fail workflow on test failure - if: ${{ failure() }} - run: exit 1 diff --git a/.github/workflows/backend-tests-streaming-serverless-function.yml b/.github/workflows/backend-tests-streaming-serverless-function.yml deleted file mode 100644 index 7133b773..00000000 --- a/.github/workflows/backend-tests-streaming-serverless-function.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Backend Tests - Streaming Serverless Function - -on: - pull_request: - branches: - - 'master' - - 'master-*' - -jobs: - run_tests_streaming_serverless: - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: "3.11" - architecture: "x64" - env: - AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache - - - name: Install dependencies - working-directory: Backend - run: | - pip install -r requirements.txt - pip install -r requirements-test.txt - - - name: Run tests Streaming Serverless/Lambda function Architecture - working-directory: Backend/ - run: | - python -m pytest tests/ - env: - MONGO_URI: mongodb://root:root@localhost:27017/ - SECRET_KEY_SIGN: ${{ secrets.SECRET_KEY_SIGN }} - SERVERLESS_FUNCTION_URL: ${{ secrets.SERVERLESS_FUNCTION_URL }} - ARCH: "STREAMING_SERVERLESS_FUNCTION" - ENV_VALUE: "PROD" - - - name: Fail workflow on test failure - if: ${{ failure() }} - run: exit 1 diff --git a/.github/workflows/deployment-backend.yml b/.github/workflows/deployment-backend.yml index 76318783..c4d3da3b 100644 --- a/.github/workflows/deployment-backend.yml +++ b/.github/workflows/deployment-backend.yml @@ -1,4 +1,4 @@ -name: Docker Deployment Test a +name: Docker Deployment Test on: pull_request: @@ -14,10 +14,35 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Install Docker prerequisites + run: | + sudo apt-get update + sudo apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg \ + lsb-release + + - name: Install Docker dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + software-properties-common + + - name: Add Docker GPG key + run: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + + - name: Set up Docker repository + run: | + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + - name: Install Docker run: | sudo apt-get update - sudo apt-get install -y docker.io + sudo apt-get install -y docker-ce docker-ce-cli containerd.io sudo systemctl start docker sudo systemctl enable docker @@ -25,7 +50,7 @@ jobs: working-directory: Backend/docker run: | docker build -t spotify_electron_backend_image . - docker run -d --name spotify_electron_backend -e MONGO_URI=mongodb://root:root@localhost:27017/ SECRET_KEY_SIGN=f24e2f3ac557d487b6d879fb2d86f2b2 SERVERLESS_FUNCTION_URL=url ARCH=BLOB ENV_VALUE=c -p 8000:8000 spotify_electron_backend_image + docker run -d --name spotify_electron_backend -e MONGO_URI=mongodb://root:root@localhost:27017/ -e SECRET_KEY_SIGN=f24e2f3ac557d487b6d879fb2d86f2b2 -e SERVERLESS_FUNCTION_URL=url -e ARCH=BLOB -e ENV_VALUE=c -p 8000:8000 spotify_electron_backend_image - name: Wait for container to start run: sleep 20s # Adjust the time as necessary based on your application's startup time diff --git a/.github/workflows/eslintrc-check.yml b/.github/workflows/eslintrc-check.yml deleted file mode 100644 index 3774e071..00000000 --- a/.github/workflows/eslintrc-check.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Eslintrc Check - -on: - pull_request: - branches: - - "master" - - "master-*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "20" - - - name: Change directory and run commands - working-directory: Electron - run: | - npm install - npm run lint diff --git a/.github/workflows/frontend-style-prettier.yml b/.github/workflows/frontend-style-prettier.yml deleted file mode 100644 index 23ee1002..00000000 --- a/.github/workflows/frontend-style-prettier.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Frontend Style Prettier - -on: - pull_request: - branches: - - "master" - - "master-*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "20" - - - name: Change directory and run commands - working-directory: Electron - run: | - npm install - npm run format:check diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml deleted file mode 100644 index 86f22980..00000000 --- a/.github/workflows/frontend-tests.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Frontend Tests - -on: - pull_request: - branches: - - "master" - - "master-*" - -jobs: - build: - runs-on: ubuntu-22.04 - - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - - - name: Change directory and run commands - working-directory: Electron - run: | - npm install - npm run build - npm test diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml deleted file mode 100644 index 82527368..00000000 --- a/.github/workflows/generate-docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Generate Docs - -on: - pull_request: - types: [closed] - -permissions: - contents: write -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Configure Git Credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v4 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - run: pip install -r requirements-docs.txt - - run: mkdocs gh-deploy --force diff --git a/.github/workflows/ruff-format-check.yml b/.github/workflows/ruff-format-check.yml deleted file mode 100644 index 02756033..00000000 --- a/.github/workflows/ruff-format-check.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Check Ruff format and styling -on: - pull_request: - branches: - - "master" - - "master-*" -jobs: - ruff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: chartboost/ruff-action@v1 - with: - args: "format --check" diff --git a/.github/workflows/ruff-lint-check.yml b/.github/workflows/ruff-lint-check.yml deleted file mode 100644 index 23112be0..00000000 --- a/.github/workflows/ruff-lint-check.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Check Ruff lint -on: - pull_request: - branches: - - "master" - - "master-*" -jobs: - ruff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: chartboost/ruff-action@v1 From 75d04de941888156fa5cd6a6f4d7c68076aed25f Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:46:06 +0200 Subject: [PATCH 3/6] a --- .github/workflows/deployment-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment-backend.yml b/.github/workflows/deployment-backend.yml index c4d3da3b..ae98f128 100644 --- a/.github/workflows/deployment-backend.yml +++ b/.github/workflows/deployment-backend.yml @@ -47,7 +47,7 @@ jobs: sudo systemctl enable docker - name: Build Docker image - working-directory: Backend/docker + working-directory: Backend/ run: | docker build -t spotify_electron_backend_image . docker run -d --name spotify_electron_backend -e MONGO_URI=mongodb://root:root@localhost:27017/ -e SECRET_KEY_SIGN=f24e2f3ac557d487b6d879fb2d86f2b2 -e SERVERLESS_FUNCTION_URL=url -e ARCH=BLOB -e ENV_VALUE=c -p 8000:8000 spotify_electron_backend_image From b558fc1c9554d4bd4bb7d271c1a4ace6e02a8efa Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:50:05 +0200 Subject: [PATCH 4/6] a --- Backend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Backend/Dockerfile b/Backend/Dockerfile index bc3d975c..df2dd321 100644 --- a/Backend/Dockerfile +++ b/Backend/Dockerfile @@ -9,6 +9,7 @@ COPY ./app /code/app WORKDIR /code/ CMD ["python", "-m", "app"] +EXPOSE 8000 #CMD ["tail", "-f", "/dev/null"] #docker build -t spotify_electron_backend_image . From 667df3199fb55baf9d3834cb0ad10dc94fb40ea4 Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:51:18 +0200 Subject: [PATCH 5/6] z --- .github/workflows/deployment-backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment-backend.yml b/.github/workflows/deployment-backend.yml index ae98f128..cf418874 100644 --- a/.github/workflows/deployment-backend.yml +++ b/.github/workflows/deployment-backend.yml @@ -57,7 +57,7 @@ jobs: - name: Check container health run: | - status=$(curl -o /dev/null -s -w '%{http_code}' localhost:8000/health) + status=$(curl -o /dev/null -s -w '%{http_code}' spotify_electron_backend:8000/health) if [[ $status -eq 200 ]]; then echo "Health check successful" else From fd3b64c42ba0b69f7f9481db9f77d1d68ba5ddec Mon Sep 17 00:00:00 2001 From: AntonioMrtz Date: Thu, 4 Jul 2024 16:53:51 +0200 Subject: [PATCH 6/6] a --- .github/workflows/deployment-backend.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment-backend.yml b/.github/workflows/deployment-backend.yml index cf418874..c544e2cd 100644 --- a/.github/workflows/deployment-backend.yml +++ b/.github/workflows/deployment-backend.yml @@ -53,11 +53,11 @@ jobs: docker run -d --name spotify_electron_backend -e MONGO_URI=mongodb://root:root@localhost:27017/ -e SECRET_KEY_SIGN=f24e2f3ac557d487b6d879fb2d86f2b2 -e SERVERLESS_FUNCTION_URL=url -e ARCH=BLOB -e ENV_VALUE=c -p 8000:8000 spotify_electron_backend_image - name: Wait for container to start - run: sleep 20s # Adjust the time as necessary based on your application's startup time + run: sleep 20s - name: Check container health run: | - status=$(curl -o /dev/null -s -w '%{http_code}' spotify_electron_backend:8000/health) + status=$(curl -o /dev/null -s -w '%{http_code}' http://127.0.0.1:8000/health) if [[ $status -eq 200 ]]; then echo "Health check successful" else