-
Notifications
You must be signed in to change notification settings - Fork 0
Added new staging/prod deployment workflow including database testing #244
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
base: main
Are you sure you want to change the base?
Changes from all commits
b77cda9
7ae4046
435e509
6dad87a
851b19b
7335dce
ca0451c
95f4d4b
941cea4
5c8f2f9
068a598
c186eac
c04792e
0cb2224
2762691
69e1a77
77ff873
b242cc0
7870f69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| blank_issues_enabled: false | ||
| contact_links: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: "Release Request" | ||
| description: "Request a deployment by specifying the evaluation function, changes, target commit/branch, and test confirmation." | ||
| title: "Release Request" | ||
| labels: | ||
| - release | ||
| - deployment | ||
| assignees: [] | ||
| body: | ||
| - type: textarea | ||
| id: description_of_changes | ||
| attributes: | ||
| label: Description of changes | ||
| description: "Summarize what is changing and why. Include links to PRs, issues, or changelogs." | ||
| placeholder: | | ||
| - What changed: | ||
| - Why: | ||
| - Related PRs/Issues: #123, #456 | ||
| render: markdown | ||
| validations: | ||
| required: true | ||
|
|
||
| - type: input | ||
| id: branch_to_deploy | ||
| attributes: | ||
| label: Branch to deploy | ||
| description: | | ||
| Specify Branch name to deploy. | ||
| placeholder: "e.g., release/2025-09-29" | ||
| validations: | ||
| required: true | ||
|
|
||
| - type: dropdown | ||
| id: version-bump | ||
| attributes: | ||
| label: "🚀 What kind of update is this?" | ||
| description: "Tell us how significant this change is. This helps us set the correct new version number." | ||
| options: | ||
| - "Patch: A small fix for a bug. It won't break anything for existing users. (e.g., 1.2.3 ➔ 1.2.4)" | ||
| - "Minor: Adds a new feature, but doesn't change how existing ones work. A safe update. (e.g., 1.2.3 ➔ 1.3.0)" | ||
| - "Major: A big change that alters existing features. Users may need to update their work to adapt. (e.g., 1.2.3 ➔ 2.0.0)" | ||
| default: 0 | ||
| validations: | ||
| required: true | ||
|
|
||
| - type: markdown | ||
| attributes: | ||
| value: | | ||
| --- | ||
| ### ⚡ Click the Link Below to Run the Workflow | ||
|
|
||
| Clicking the link will take you to the Actions page. You will need to click the **"Run workflow"** button there to start the process. | ||
|
|
||
| ## [➡️ Go to Workflow Run Page](../actions/workflows/production-deploy.yml) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Deploy to Production | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version-bump: | ||
| description: 'Version bump type' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| default: patch | ||
| branch: | ||
| description: 'Branch to release from' | ||
| required: true | ||
| type: string | ||
| default: 'main' | ||
| jobs: | ||
| deploy: | ||
| uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request | ||
| with: | ||
| template-repository-name: 'lambda-feedback/evaluation-function-boilerplate-python' | ||
| build-file: "app/Dockerfile" | ||
| build-context: "./app" | ||
| environment: "production" | ||
| version-bump: ${{ inputs.version-bump }} | ||
| branch: ${{ inputs.branch }} | ||
| run-database-tests: true | ||
|
|
||
| secrets: | ||
| aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} | ||
| aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}} | ||
| function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}} | ||
| gcp_credentials: ${{ secrets.GCP_DEPLOY }} | ||
| TEST_API_ENDPOINT: ${{ secrets.TEST_API_ENDPOINT }} | ||
| DB_USER: ${{ secrets.DB_USER }} | ||
| DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
| DB_HOST: ${{ secrets.DB_HOST }} | ||
| DB_PORT: ${{ secrets.DB_PORT }} | ||
| DB_NAME: ${{ secrets.DB_NAME }} | ||
| GCP_DB_CREDS: ${{ secrets.GCP_DB_CREDS }} | ||
| GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Deploy to Staging | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| actions: read | ||
| checks: write | ||
| pull-requests: write | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.8"] | ||
neagualexa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| id: python-setup | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m venv .venv | ||
| .venv/bin/pip install pytest | ||
| .venv/bin/pip install -r app/requirements.txt | ||
|
|
||
|
|
||
| - name: Lint with flake8 | ||
| run: | | ||
| source .venv/bin/activate | ||
| .venv/bin/pip install flake8 | ||
| # stop the build if there are Python syntax errors or undefined names | ||
| flake8 ./app --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
| flake8 ./app --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
|
|
||
| - name: Run tests | ||
| if: always() | ||
| run: | | ||
| source .venv/bin/activate | ||
| pytest --junit-xml=./reports/pytest.xml --tb=auto -v | ||
|
|
||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-results-${{ matrix.python-version }} | ||
| path: ./reports/pytest.xml | ||
| if-no-files-found: warn | ||
| deploy: | ||
| needs: test | ||
| uses: lambda-feedback/evaluation-function-workflows/.github/workflows/deploy.yml@deploy-request | ||
| with: | ||
| template-repository-name: "lambda-feedback/evaluation-function-boilerplate-python" | ||
| build-file: "app/Dockerfile" | ||
| build-context: "./app" | ||
| build-platforms: "aws" | ||
| environment: "staging" | ||
| lfs: false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why doesn't staging also have the run-tests : true?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run-tests here, means databases tests. I will rename this. Database tests is where we have a LambdaFunction call the data analysis database and call the staging deployment, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renaming would be helpful thanks
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to run-database-tests |
||
| secrets: | ||
| aws-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }} | ||
| aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}} | ||
| function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY}} | ||
| gcp_credentials: ${{ secrets.GCP_DEPLOY }} | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.