forked from runfinch/finch-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 3.84 KB
/
samcli-direct.yaml
File metadata and controls
133 lines (112 loc) · 3.84 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: samcli-direct
on:
pull_request:
branches:
- main
paths-ignore:
- '**.md'
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
env:
GO_VERSION: '1.24.11'
permissions:
id-token: write
contents: read
jobs:
samcli-direct-test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
test_type: [unit, package, invoke, start-lambda, start-api]
env:
AWS_DEFAULT_REGION: "${{ secrets.REGION }}"
DOCKER_HOST: unix:///var/run/finch.sock
DOCKER_CONFIG: $HOME/.finch
BY_CANARY: true # allows full testing
SAM_CLI_DEV: 1
SAM_CLI_TELEMETRY: 0
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
with:
role-to-assume: ${{secrets.SAMCLI_DIRECT_ROLE_BASE}}
role-session-name: samcli-${{ matrix.test_type }}-tests
aws-region: ${{ secrets.REGION }}
role-duration-seconds: 2000
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GO_VERSION }}
# from aws/aws-sam-cli/setup.py: python_requires=">=3.9, <=4.0, !=4.0
- name: Set up Python
uses: actions/setup-python@v4
with:
# python version should match https://github.com/aws/aws-sam-cli/blame/develop/tests/integration/testdata/durable/template.yaml
python-version: '3.13'
- name: Checkout finch-daemon
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Stop pre-existing services
run: |
sudo systemctl stop docker
sudo systemctl stop containerd
- name: Remove default podman network config
run: |
sudo rm -f /etc/cni/net.d/87-podman-bridge.conflist
- name: Clean up Daemon socket
run: |
sudo rm -f /run/finch.sock
sudo rm -f /run/finch.pid
sudo rm -f /run/finch-credential.sock
- name: Install finch-daemon dependencies
run: |
./setup-test-env.sh
sleep 10
- name: Build and start finch-daemon
run: |
make build
sudo bin/finch-daemon --debug --socket-owner $UID 2>&1 | tee finch-daemon.log &
sleep 10
- name: Get latest SAM CLI tag
id: sam-tag
run: |
TAG=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r .tag_name)
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Checkout SAM CLI
uses: actions/checkout@v4
with:
repository: aws/aws-sam-cli
submodules: recursive
path: aws-sam-cli
ref: ${{ steps.sam-tag.outputs.tag }}
- name: Set up SAM CLI from source
working-directory: aws-sam-cli
run: |
python -m pip install --upgrade pip
make init
samdev --version
- name: Run ${{ matrix.test_type }} tests
run: ./scripts/samcli-direct/run-${{ matrix.test_type }}-tests.sh
- name: Show finch-daemon logs
if: always()
run: |
echo "=== FINCH-DAEMON OUTPUT ==="
cat finch-daemon.log
# ensuring resources are clean post-test
cleanup:
runs-on: ubuntu-latest
needs: samcli-direct-test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
with:
role-to-assume: ${{ secrets.SAMCLI_DIRECT_ROLE_BASE }}
role-session-name: cleanup-samcli-direct
aws-region: ${{ secrets.REGION }}
- name: Comprehensive AWS resource cleanup
timeout-minutes: 10
run: ./scripts/cleanup-aws-resources.sh