Skip to content

Commit

Permalink
reverting workflow changes (#2498)
Browse files Browse the repository at this point in the history
* reverting workflow changes

* changes 1

* identation fix
  • Loading branch information
prayanshchh authored Nov 28, 2024
1 parent b28fcde commit c80b44f
Showing 1 changed file with 134 additions and 7 deletions.
141 changes: 134 additions & 7 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@v45
- name: Check formatting
if: steps.changed-files.outputs.only_changed != 'true'
run: npm run format:check
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Check for linting errors in modified files
if: steps.changed-files.outputs.only_changed != 'true'
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py

- name: Check for TSDoc comments
Expand Down Expand Up @@ -92,9 +92,10 @@ jobs:

- name: Get Changed Unauthorized files
id: changed-unauth-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@v45
with:
files: |
.env*
.github/**
env.example
.node-version
Expand Down Expand Up @@ -123,6 +124,12 @@ jobs:
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
*.pem
*.key
*.cert
*.password
*.secret
*.credentials
- name: List all changed unauthorized files
if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
Expand All @@ -144,7 +151,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@v45

- name: Echo number of changed files
env:
Expand Down Expand Up @@ -197,7 +204,7 @@ jobs:

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@v45

- name: Run Jest Tests
if: steps.changed-files.outputs.only_changed != 'true'
Expand Down Expand Up @@ -230,14 +237,14 @@ jobs:
fi
done
- name: Upload Coverage to Codecov
- name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: false
files: './coverage/lcov.info'
name: '${{env.CODECOV_UNIQUE_NAME}}'
fail_ci_if_error: false

- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
Expand Down Expand Up @@ -272,6 +279,126 @@ jobs:
- name: Validate Documents
run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql'
Start-App-Without-Docker:
name: Check if Talawa Admin app starts (No Docker)
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Test-Application]
if: github.actor != 'dependabot'
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install Dependencies
run: npm install

- name: Build Production App
run: npm run build

- name: Start Production App
run: |
npm run preview &
echo $! > .pidfile_prod
- name: Check if Production App is running
run: |
timeout=120
echo "Starting production health check with ${timeout}s timeout"
while ! nc -z localhost 4173 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for production app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for production application to start"
exit 1
fi
echo "Production app started successfully"
- name: Stop Production App
run: |
if [ -f .pidfile_prod ]; then
kill "$(cat .pidfile_prod)"
fi
- name: Start Development App
run: |
npm run serve &
echo $! > .pidfile_dev
- name: Check if Development App is running
run: |
timeout=120
echo "Starting development health check with ${timeout}s timeout"
while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for development app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for development application to start"
exit 1
fi
echo "Development app started successfully"
- name: Stop Development App
if: always()
run: |
if [ -f .pidfile_dev ]; then
kill "$(cat .pidfile_dev)"
fi
Docker-Start-Check:
name: Check if Talawa Admin app starts in Docker
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, Test-Application]
if: github.actor != 'dependabot'
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:latest
- name: Build Docker image
run: |
set -e
echo "Building Docker image..."
docker build -t talawa-admin-app .
echo "Docker image built successfully"
- name: Run Docker Container
run: |
set -e
echo "Started Docker container..."
docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app
echo "Docker container started successfully"
- name: Check if Talawa Admin App is running
run: |
timeout="${HEALTH_CHECK_TIMEOUT:-120}"
echo "Starting health check with ${timeout}s timeout"
while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
if [ $((timeout % 10)) -eq 0 ]; then
echo "Still waiting for app to start... ${timeout}s remaining"
fi
done
if [ $timeout -eq 0 ]; then
echo "Timeout waiting for application to start"
echo "Container logs:"
docker logs talawa-admin-app-container
exit 1
fi
echo "Port check passed, verifying health endpoint..."
- name: Stop Docker Container
if: always()
run: |
docker stop talawa-admin-app-container
docker rm talawa-admin-app-container
Check-Target-Branch:
if: ${{ github.actor != 'dependabot[bot]' }}
Expand Down

0 comments on commit c80b44f

Please sign in to comment.