From c6c4c5cbb150fae5afe6a2a240b60ab8edb8f433 Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Thu, 5 Sep 2024 17:23:53 +0545 Subject: [PATCH] fix: run -> exec on test compose --- .github/workflows/backend_functional_test.yml | 150 ------------------ .github/workflows/build_and_deploy.yml | 2 +- .github/workflows/test_compose.yml | 5 +- 3 files changed, 3 insertions(+), 154 deletions(-) delete mode 100644 .github/workflows/backend_functional_test.yml diff --git a/.github/workflows/backend_functional_test.yml b/.github/workflows/backend_functional_test.yml deleted file mode 100644 index 27982ddb1b..0000000000 --- a/.github/workflows/backend_functional_test.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: Backend Functional Test - -on: - workflow_call: - inputs: - runner-class: - description: "Github Runner class to use" - required: false - type: string - default: "ubuntu-latest" - node-version: - description: "Node version to use." - required: false - type: string - default: "18.x" - node-version-file: - description: "Node version file to use. node-version overrides this parameter." - required: false - type: string - default: "" - context: - description: "Root directory to start the build from." - required: false - type: string - default: "." - cache: - description: "Use node modules installation caching. Default true." - required: false - type: boolean - default: true - cache-key-file: - description: "Key file for cache." - required: false - type: string - default: "${{ inputs.context }}/package.json" - package-manager: - description: "Package manager to use. Supports [npm, yarn]" - required: false - type: string - default: "npm" - build-script-name: - description: "Build script name in package.json" - required: false - type: string - default: "build" - upload-artifacts: - description: "Upload artifacts to Github" - required: false - type: boolean - default: true - build-dist-folder-path: - description: "Path to folder that stores build files" - required: false - type: string - default: "${{ inputs.context }}/dist" - - outputs: - artifact-name: - description: "Node built artifact" - value: ${{ jobs.node-build.outputs.artifact-name }} - -jobs: - node-build: - runs-on: ${{ inputs.runner-class }} - - environment: - name: ${{ github.ref_name }} - - outputs: - artifact-name: ${{ steps.get_artifact_name.outputs.artifact_name }} - - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - id: node_setup - name: Install node - uses: actions/setup-node@v4 - #reference: https://github.com/actions/setup-node - with: - node-version: ${{ inputs.node-version }} - node-version-file: ${{ inputs.node-version-file && inputs.node-version-file || '' }} - - - name: Cache Node packages - uses: actions/cache@v3 - env: - cache_name: node-${{ inputs.node-version || hashFiles(inputs.node-version-file) }}-${{ inputs.package-manager }}-${{ hashFiles(inputs.cache-key-file) }} - with: - key: ${{ runner.os }}-build-${{ env.cache_name }} - path: | - ~/.npm - restore-keys: | - ${{ runner.os }}-build-${{ env.cache_name }} - - - id: node_packages_install - name: Install node pacakges - working-directory: ${{ inputs.context }} - run: | - case "${{ inputs.package-manager }}" in - yarn) - yarn - ;; - npm) - npm i - ;; - esac - - - id: vars_and_secrets - name: Vars and Secrets to Env file - env: - VARS_CONTEXT: ${{ toJson(vars) }} - SECRETS_CONTEXT: ${{ toJson(secrets) }} - shell: bash - run: | - parsed_vars=$(jq -n --argjson VARS_CONTEXT "$VARS_CONTEXT" --argjson SECRETS_CONTEXT "$SECRETS_CONTEXT" "$VARS_CONTEXT+$SECRETS_CONTEXT") - to_envs() { jq -r "to_entries[] | \"\(.key)=\\\"\(.value)\\\"\n\""; } - echo "$parsed_vars" | to_envs > ${{ inputs.context }}/.env - - - id: build_frontend - name: Build Frontend - working-directory: ${{ inputs.context }} - run: | - case "${{ inputs.package-manager }}" in - yarn) - yarn ${{ inputs.build-script-name }} - ;; - npm) - npm run ${{ inputs.build-script-name }} - ;; - esac - - - id: upload_build_artifacts - name: Upload build files as build artifacts - uses: actions/upload-artifact@v4 - if: ${{ inputs.upload-artifacts }} - with: - name: ${{ github.repository_id }}-${{ github.sha }}-frontend-build-dist - path: ${{ inputs.build-dist-folder-path }} - retention-days: 1 - - - id: get_artifact_name - name: Get First Image Name - run: | - echo "artifact_name=${{ github.repository_id }}-${{ github.sha }}-frontend-build-dist" >> $GITHUB_OUTPUT - echo "Frontend Artifact Name: $artifact_name" - diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index d48f4edc9b..268ab2f1ce 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -24,7 +24,7 @@ jobs: compose_service: tm-backend build_target: prod compose_command: | - pip install flake8 + # pip install flake8 # flake8 manage.py backend migrations # pip install 'black==23.12.1' # black --check manage.py backend migrations diff --git a/.github/workflows/test_compose.yml b/.github/workflows/test_compose.yml index 0a1e5f19d9..73a89d4a01 100644 --- a/.github/workflows/test_compose.yml +++ b/.github/workflows/test_compose.yml @@ -276,10 +276,9 @@ jobs: if: ${{ ! inputs.coverage && ! inputs.playwright }} run: | ${{ inputs.pre_command }} - + docker compose --file ${{ inputs.compose_file }} \ - run --no-TTY \ - ${{ inputs.compose_service }} ${{ inputs.compose_command }} + exec -i ${{ inputs.compose_service }} ${{ inputs.compose_command }} # Specific for generating coverage - name: Run Tests With Coverage