-
Notifications
You must be signed in to change notification settings - Fork 5
61 lines (60 loc) · 2.44 KB
/
weekly_e2e.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
name: Weekly E2E Test Check
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
jobs:
weekly-e2e-check:
if: github.repository_owner == 'alibabacloud-automation'
name: 'weekly e2e check'
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: checkout
uses: actions/checkout@v3
- name: set id
id: set-job-id
uses: ayachensiyuan/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: 'weekly e2e check'
- name: Get job id
run: |
echo "The current job id is ${{ steps.set-job-id.outputs.jobId }}"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: weekly e2e test
run: |
objectPath="github-action/${{github.repository}}/weekly-e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}"
echo "default branch: ${{ steps.extract_branch.outputs.branch }}"
go run scripts/curl_fc_trigger.go ${{ steps.extract_branch.outputs.branch }} ${{github.repository}} ${objectPath}
go run scripts/e2e_check.go ${objectPath}
- name: whether to upload test record
id: whether-to-upload-test-record
run: |
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
modules=$(curl -sL "https://terraform-fc-test-for-example-module.oss-ap-southeast-1.aliyuncs.com/testRecordReleased.json")
if echo "$modules" | jq --arg key "$REPO_NAME" -re 'has($key)' | grep -q true; then
echo "The key exists at the JSON object."
echo "::set-output name=output_value::1"
else
echo "The key does not exist at the JSON object."
echo "::set-output name=output_value::0"
fi
- name: update test record
if: steps.whether-to-upload-test-record.outputs.output_value == 1
run: |
git add TestRecord.md
cd .git
sudo chmod -R a+rwX .
sudo find . -type d -exec chmod g+s '{}' +
- name: Commit & Push changes
if: steps.whether-to-upload-test-record.outputs.output_value == 1
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'Update TestRecord'
branch: ${{ steps.extract_branch.outputs.branch }}