Skip to content

chore(deps): bump github/codeql-action from 3.25.15 to 3.26.10 (#882) #77

chore(deps): bump github/codeql-action from 3.25.15 to 3.26.10 (#882)

chore(deps): bump github/codeql-action from 3.25.15 to 3.26.10 (#882) #77

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Main Branch - Serverless Service CI/CD
permissions:
contents: read
env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.12"
AWS_REGION: "us-east-1"
on:
workflow_dispatch:
push:
branches: [main]
jobs:
staging:
runs-on: ubuntu-latest
environment: staging
permissions:
id-token: write # required for requesting the JWT (GitHub OIDC)
steps:
- run: |
echo "🎉 The job was automatically triggered by a ${{ env.EVENT_NAME }} event." >> $GITHUB_STEP_SUMMARY
echo "🐧 This job is now running on a ${{ env.OS_NAME }} ${{env.OS_ARCH}} server hosted by GitHub!" >> $GITHUB_STEP_SUMMARY
echo "🔎 The name of your branch is ${{ env.BRANCH_NAME }} and your repository is ${{ env.REPO_NAME }}." >> $GITHUB_STEP_SUMMARY
env:
EVENT_NAME: ${{ github.event_name}}
OS_NAME: ${{ runner.os }}
OS_ARCH: ${{runner.arch }}
BRANCH_NAME: ${{ github.ref }}
REPO_NAME: ${{ github.repository }}
- name: Check out repository code
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: make dev
# NOTE: unit tests are connecting to AWS to instantiate boto3 clients/resources
# once that's discussed we can move unit and infra tests as part of the fast quality standards
# see https://github.com/ran-isenberg/serverless-python-demo/pull/38#discussion_r1299372169
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets['AWS_ROLE'] }}
role-session-name: ${{ env.SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
env:
SESSION_NAME: "github-${{github.sha}}-staging"
- name: Deploy to AWS
run: make deploy
env:
ENVIRONMENT: staging # Custom environment variable
# NOTE: these run unit and integration tests
# we can look into coverage collection only later to make it faster and less brittle (--collect-only)
- name: Code coverage tests
run: make coverage-tests
env:
ENVIRONMENT: staging # Custom environment variable
- name: Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: yes # optional (default = false)
verbose: yes # optional (default = false)
- name: Run E2E tests
run: make e2e
env:
ENVIRONMENT: staging # Custom environment variable
production:
runs-on: ubuntu-latest
needs: [staging]
environment: production
permissions:
id-token: write # required for requesting the JWT (GitHub OIDC)
steps:
- run: |
echo "🎉 The job was automatically triggered by a ${{ env.EVENT_NAME }} event." >> $GITHUB_STEP_SUMMARY
echo "🐧 This job is now running on a ${{ env.OS_NAME }} ${{env.OS_ARCH}} server hosted by GitHub!" >> $GITHUB_STEP_SUMMARY
echo "🔎 The name of your branch is ${{ env.BRANCH_NAME }} and your repository is ${{ env.REPO_NAME }}." >> $GITHUB_STEP_SUMMARY
env:
EVENT_NAME: ${{ github.event_name}}
OS_NAME: ${{ runner.os }}
OS_ARCH: ${{runner.arch }}
BRANCH_NAME: ${{ github.ref }}
REPO_NAME: ${{ github.repository }}
- name: Check out repository code
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: make dev
# NOTE: unit tests are connecting to AWS to instantiate boto3 clients/resources
# once that's discussed we can move unit and infra tests as part of the fast quality standards
# see https://github.com/ran-isenberg/serverless-python-demo/pull/38#discussion_r1299372169
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets['AWS_ROLE'] }}
role-session-name: ${{ env.SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
env:
SESSION_NAME: "github-${{github.sha}}-production"
- name: Deploy to AWS
run: make deploy
env:
ENVIRONMENT: production # Custom environment variable
publish_github_pages:
runs-on: ubuntu-latest
needs: [production]
permissions:
contents: write # for docs push
if: contains('refs/heads/main', github.ref)
steps:
- name: Check out repository code
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: make dev
- name: Generate docs
run: |
poetry run mkdocs gh-deploy --force