-
Notifications
You must be signed in to change notification settings - Fork 0
Update scheduled-validation.yml #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mr-adonis-jimenez
wants to merge
2
commits into
main
Choose a base branch
from
mr-adonis-jimenez-patch-12
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,30 @@ | ||
| name: policy-enforcement | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| - release/** | ||
| push: | ||
| paths: | ||
| - 'requirements.txt' | ||
| - 'SECURITY.md' | ||
| - 'LICENSE' | ||
| - '.github/workflows/security-checks.yml' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| checks: write | ||
|
|
||
| concurrency: | ||
| group: policy-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| schedule: | ||
| # Weekly security scan every Monday at 9 AM UTC | ||
| - cron: '0 9 * * 1' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| enforce-policy: | ||
| name: policy / enforce | ||
| dependency-check: | ||
| name: Python Dependency Security Scan | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Validate branch naming | ||
| run: | | ||
| BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | ||
| echo "Branch: $BRANCH" | ||
|
|
||
| if [[ ! "$BRANCH" =~ ^(main|release\/.+|feature\/.+|bugfix\/.+|hotfix\/.+)$ ]]; then | ||
| echo "❌ Invalid branch name" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify signed commits | ||
| run: | | ||
| git log --format='%G?' origin/main..HEAD | grep -vq '^[GU]$' && { | ||
| echo "❌ Unsigned or unverified commits detected" | ||
| exit 1 | ||
| } || echo "✅ All commits verified" | ||
|
|
||
| - name: Lint configuration files | ||
| run: | | ||
| yamllint .github || exit 1 | ||
|
|
||
| - name: Dependency vulnerability scan | ||
| uses: github/dependency-review-action@v4 | ||
| with: | ||
| fail-on-severity: high | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: CI policy summary | ||
| run: | | ||
| echo "✅ Policy enforcement passed" | ||
| - name: Set up Python | ||
| u |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,34 @@ | ||
| # Simplified workflow - Line 111 error fixed | ||
| name: Scheduled Analytics & Validation | ||
| name: Scheduled Validation | ||
|
|
||
| on: | ||
| schedule: | ||
| # Runs at 2 AM UTC every day | ||
| - cron: '0 2 * * *' | ||
| workflow_dispatch: | ||
| inputs: | ||
| validation_type: | ||
| description: 'Type of validation to run' | ||
| required: false | ||
| default: 'full' | ||
| type: choice | ||
| options: | ||
| - full | ||
| - quick | ||
| - custom | ||
| skip_tests: | ||
| description: 'Skip test suite' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| jobs: | ||
| nightly-validation: | ||
| name: Nightly Database Validation | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:15-alpine | ||
| env: | ||
| POSTGRES_USER: retail_admin | ||
| POSTGRES_PASSWORD: validation_password | ||
| POSTGRES_DB: retail_analytics_nightly | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| ports: | ||
| - 5432:5432 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Determine validation type | ||
| id: config | ||
| run: | | ||
| pip install --upgrade pip psycopg2-binary | ||
|
|
||
| - name: Apply schema | ||
| env: | ||
| PGPASSWORD: validation_password | ||
| run: | | ||
| psql -h localhost -U retail_admin -d retail_analytics_nightly -f schema/schema.sql -v ON_ERROR_STOP=1 | ||
|
|
||
| - name: Load sample data | ||
| env: | ||
| PGHOST: localhost | ||
| PGUSER: retail_admin | ||
| PGPASSWORD: validation_password | ||
| PGDATABASE: retail_analytics_nightly | ||
| run: | | ||
| python scripts/generate_data.py | ||
|
|
||
| - name: Run all queries | ||
| env: | ||
| PGPASSWORD: validation_password | ||
| run: | | ||
| for sql_file in queries/*.sql; do | ||
| echo "Running: $sql_file" | ||
| psql -h localhost -U retail_admin -d retail_analytics_nightly -f "$sql_file" | ||
| done | ||
| # When triggered by schedule, use 'full' validatio | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scheduled workflow now ends after a no-op “Determine validation type” step, so it never applies the schema, loads data, or runs any queries/tests. That means both the nightly schedule and manual dispatch will succeed without validating anything, which defeats the purpose of this workflow and can let regressions slip through unnoticed. If this is intentional, a separate validation job needs to be added; otherwise the removed steps need to be reinstated.
Useful? React with 👍 / 👎.