generated from ran-isenberg/aws-lambda-handler-cookbook
-
-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (78 loc) · 2.95 KB
/
cookiecutter-test.yml
File metadata and controls
84 lines (78 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Cookiecutter Template Test
permissions:
contents: read
env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.13"
AWS_REGION: "us-east-1"
on:
workflow_dispatch:
pull_request:
branches: [main]
jobs:
setup:
runs-on: ubuntu-latest
environment: ci
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
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@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: |
pip install --upgrade pip poetry
poetry config --local virtualenvs.in-project true
poetry install --no-root
npm ci
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: ${{ env.SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
env:
SESSION_NAME: "github-${{github.sha}}-dev"
- name: Run Cookiecutter with predefined answers
run: |
# Create a cookiecutter-answers.json file with predefined answers
cat > cookiecutter-answers.json << EOF
{
"repo_name": "test_serverless_service",
"service_name": "test_service",
"email": "test@example.com",
"author": "Test User",
"description": "A test serverless service for CI"
}
EOF
# Run cookiecutter with the answers file
cookiecutter --no-input -f --config-file cookiecutter-answers.json .
- name: Run cybr pr command
run: |
cd test_serverless_service
make dev
make pr
- name: Destroy stack
if: always()
run: make destroy