-
Notifications
You must be signed in to change notification settings - Fork 28
88 lines (77 loc) · 2.58 KB
/
pmm-cli.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
86
87
88
on:
workflow_dispatch:
inputs:
client_tar_url:
description: 'client tar url'
required: true
type: string
pmm_branch:
description: "percona/pmm branch to checkout"
required: false
type: string
sha:
description: 'commit sha to report status'
required: false
type: string
jobs:
pmm-cli:
name: 'PMM binary CLI tests'
runs-on: ubuntu-20.04
env:
CLIENT_TAR_URL: ${{ github.event.inputs.client_tar_url }}
WORK_DIR: ./pmm/cli-tests
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}
PMM_BRANCH: ${{ inputs.pmm_branch || 'main' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.PMM_BRANCH }}
repository: percona/pmm
path: ./pmm
- name: Set Client tar name env variable
run: echo "PMM_CLIENT_TAR=$(echo ${{ env.CLIENT_TAR_URL }} | grep -o '[^/]*$')" >> $GITHUB_ENV
- name: Download client
run: |
sudo wget ${{ env.CLIENT_TAR_URL }}
- name: Unzip client
run: |
tar -xzf ${{ env.PMM_CLIENT_TAR }}
echo "PMM_CLIENT_BASEDIR=$(ls -1td pmm2-client-* 2>/dev/null | grep -v ".tar" | head -n1)" >> $GITHUB_ENV
- name: Rename client folder
run: mv ${{ env.PMM_CLIENT_BASEDIR }} pmm2-client
- name: Check pmm version output
working-directory: pmm2-client
run: |
echo "export PATH=$PATH:$PWD/bin" >> ~/.bash_profile
source ~/.bash_profile
pmm --version
- name: Install Dependencies
working-directory: ${{ env.WORK_DIR }}
run: npm ci
- name: Run tests
working-directory: ${{ env.WORK_DIR }}
run: |
source ~/.bash_profile
npm run test:pmm-cli
- name: Create status check
if: ${{ github.event.inputs.sha && always() }}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
SHA: ${{ inputs.sha }}
STATUS: ${{ job.status }}
run: |
if [ "${STATUS}" = "cancelled" ]; then
STATUS="error"
fi
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/$REPO/statuses/$SHA \
-f state="$STATUS" \
-f target_url="https://github.com/$REPO/actions/runs/$RUN_ID" \
-f description="PMM binary CLI Tests $STATUS" \
-f context='actions/workflows/pmm-cli'