-
Notifications
You must be signed in to change notification settings - Fork 67
91 lines (79 loc) · 2.78 KB
/
test.yml
File metadata and controls
91 lines (79 loc) · 2.78 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
name: CI Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
prepare-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
mapfile -t dirs < <(find . -mindepth 2 -type f -name "Makefile" ! -path "./sample-archive/*" ! -path "./sagemaker-inference/*" | sed "s|/Makefile||" | sort)
echo "matrix=$(printf '%s\n' "${dirs[@]}" | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run-tests:
name: Run tests for sample (${{ matrix.directory }})
runs-on: ubuntu-latest
needs: prepare-list
strategy:
fail-fast: false
max-parallel: 8
matrix:
directory: ${{ fromJSON(needs.prepare-list.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install LocalStack
run: pip install localstack awscli-local[ver1] virtualenv
- name: Setup config
run: |
echo "Configuring git for codecommit sample"
git config --global user.email "localstack.sample@localstack.cloud"
git config --global user.name "Localstack Pro-Samples"
- name: Pull the latest docker image
run: docker pull localstack/localstack-pro
- name: Execute tests
timeout-minutes: 10
run: |
cd ${{ matrix.directory }}
make test-ci
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
DEBUG: 1
DNS_ADDRESS: 127.0.0.1
- name: Compute sample name
if: always()
id: sample-name
run: |
name="${{ matrix.directory }}"
name="${name#./}"
name="${name//\//-}"
echo "name=$name" >> "$GITHUB_OUTPUT"
- name: Send a Slack notification
if: failure() || github.event_name != 'pull_request'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "Sample `${{ steps.sample-name.outputs.name }}` ({workflow}) has {status_message}"
message_format: "{emoji} *${{ steps.sample-name.outputs.name }}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Upload LocalStack logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs-${{ steps.sample-name.outputs.name }}
path: ${{ matrix.directory }}/logs.txt
if-no-files-found: ignore