-
Notifications
You must be signed in to change notification settings - Fork 10
86 lines (82 loc) · 3.12 KB
/
test.yml
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
name: test
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
services:
description: Space delimited string of services to test. If empty, all will be built.
type: string
schedule:
- cron: '0 0 * * 1'
env:
TASK_VERSION: v3.29.1
TASK_CHECKSUM: e411770abf73d5e094100ab7a1c8278f35b591ecadbfd778200b6b2ad1ee340b
PUSH: false
jobs:
detect-pr-services:
name: Detect PR services
runs-on: ubuntu-latest
outputs:
services: ${{ steps.detect-services.outputs.services }}
steps:
- uses: actions/checkout@v3
if: github.event_name == 'pull_request'
- id: detect-services
if: github.event_name == 'pull_request'
run: |
git fetch origin main
echo "services=$(.github/workflows/detect-pr-services.sh)" >> $GITHUB_OUTPUT
matrix:
name: Create service matrix
needs: detect-pr-services
runs-on: ubuntu-latest
if: always() && github.event_name != 'pull_request' || needs.detect-pr-services.outputs.services
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: .github/workflows/gha-matrix.sh ${{ inputs.services || needs.detect-pr-services.outputs.services }} >> $GITHUB_OUTPUT
test:
name: Test service
needs: matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
fail-fast: false
steps:
# v1.3.1
- uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
# Some of our services need a lot of free disk. We run this action to
# free up some disk space, however it is slow, so we conditionally do
# this only on those services that need it.
if: matrix.service == 'opensearch' || matrix.service == 'dynamodb'
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update
&& sudo apt-get install -y eatmydata
&& sudo ln -snf /usr/bin/eatmydata /usr/local/bin/apt-get
&& sudo apt-get install -y parallel jq curl
&& curl -L -o /tmp/task_linux_amd64.deb https://github.com/go-task/task/releases/download/${{ env.TASK_VERSION }}/task_linux_amd64.deb
&& sha256sum /tmp/task_linux_amd64.deb | grep -q ${{ env.TASK_CHECKSUM }}
&& sudo dpkg -i /tmp/task_linux_amd64.deb
&& sudo apt-get clean
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
# Expose the actions cache url and token.
# https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication
name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- run: task -- ${{ matrix.service }}
id: task
- name: Test healthcheck
run: task test -- ${{ matrix.service }}