Skip to content

Commit cabb547

Browse files
liya2017liya2017
authored andcommitted
ci: add ci monitoring
1 parent 61fab51 commit cabb547

16 files changed

Lines changed: 483 additions & 0 deletions

‎.github/workflows/ci_aarch64_build_ubuntu.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,41 @@ jobs:
4747
- uses: actions/checkout@v2
4848
- name: ci_aarch64_build_ubuntu
4949
run: |
50+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
51+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
52+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
5053
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
5154
devtools/ci/ci_main.sh
5255
else
5356
echo "skip job"
5457
exit 0
5558
fi
59+
- name: Set test state when success
60+
if: ${{ success() }}
61+
run: |
62+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
63+
shell: bash
64+
- name: Set test state when test failed.
65+
if: ${{ failure() }}
66+
run: |
67+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
68+
shell: bash
69+
- name: insert data to DB
70+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
71+
run: |
72+
if [[ ! -z "${{ env.PGHOST }}" ]];then
73+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
74+
echo $end_time
75+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
76+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','ubuntu','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
77+
fi
78+
shell: bash
79+
env:
80+
PGHOST: ${{ secrets.PGHOST }}
81+
PGPORT: ${{ secrets.PGPORT }}
82+
PGUSER: ${{ secrets.PGUSER }}
83+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
84+
PGDATABASE: ckbtest
5685
env:
5786
RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }}
5887

‎.github/workflows/ci_benchmarks_macos.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,41 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@v2
5656
- run: |
57+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV
58+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
59+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
5760
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
5861
devtools/ci/ci_main.sh
5962
else
6063
echo "skip job"
6164
exit 0
6265
fi
6366
shell: bash
67+
- name: Set test state when success
68+
if: ${{ success() }}
69+
run: |
70+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
71+
shell: bash
72+
- name: Set test state when test failed.
73+
if: ${{ failure() }}
74+
run: |
75+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
76+
shell: bash
77+
- name: insert data to DB
78+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
79+
run: |
80+
if [[ ! -z "${{ env.PGHOST }}" ]];then
81+
end_time=$(date +%Y-%m-%d' '%H:%M:%S)
82+
echo $end_time
83+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
84+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','macOS','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
85+
fi
86+
shell: bash
87+
env:
88+
PGHOST: ${{ secrets.PGHOST }}
89+
PGPORT: ${{ secrets.PGPORT }}
90+
PGUSER: ${{ secrets.PGUSER }}
91+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
92+
PGDATABASE: ckbtest
6493
env:
6594
RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }}

‎.github/workflows/ci_benchmarks_ubuntu.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,41 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@v2
5656
- run: |
57+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
58+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
59+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
5760
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
5861
devtools/ci/ci_main.sh
5962
else
6063
echo "skip job"
6164
exit 0
6265
fi
6366
shell: bash
67+
- name: Set test state when success
68+
if: ${{ success() }}
69+
run: |
70+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
71+
shell: bash
72+
- name: Set test state when test failed.
73+
if: ${{ failure() }}
74+
run: |
75+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
76+
shell: bash
77+
- name: insert data to DB
78+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
79+
run: |
80+
if [[ ! -z "${{ env.PGHOST }}" ]];then
81+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
82+
echo $end_time
83+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
84+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','ubuntu','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
85+
fi
86+
shell: bash
87+
env:
88+
PGHOST: ${{ secrets.PGHOST }}
89+
PGPORT: ${{ secrets.PGPORT }}
90+
PGUSER: ${{ secrets.PGUSER }}
91+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
92+
PGDATABASE: ckbtest
6493
env:
6594
RUNNER_LABEL: ${{ needs.prologue.outputs.linux_runner_label }}

‎.github/workflows/ci_benchmarks_windows.yaml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,51 @@ jobs:
6262
scoop install git
6363
scoop bucket add extras
6464
scoop install llvm yasm
65+
$pgService = Get-Service -Name postgresql*
66+
Set-Service -InputObject $pgService -Status running -StartupType automatic
67+
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
6568
- run: |
69+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
70+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
71+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
6672
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
6773
devtools/ci/ci_main.sh
6874
else
6975
echo "skip job"
7076
exit 0
7177
fi
7278
shell: bash
79+
- name: Set test state when success
80+
if: ${{ success() }}
81+
run: |
82+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
83+
shell: bash
84+
- name: Set test state when test failed.
85+
if: ${{ failure() }}
86+
run: |
87+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
88+
shell: bash
89+
- name: insert data to DB
90+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
91+
run: |
92+
if [[ ! -z "${{ env.PGHOST }}" ]];then
93+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
94+
sql="INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
95+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','windows','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
96+
echo $RUNNER_LABEL
97+
if [[ $RUNNER_LABEL == 'windows-2019' ]];then
98+
echo "github action"
99+
"$PGBIN\psql" -c "$sql"
100+
else
101+
psql -c "$sql"
102+
fi
103+
fi
104+
shell: bash
105+
env:
106+
PGHOST: ${{ secrets.PGHOST }}
107+
PGPORT: ${{ secrets.PGPORT }}
108+
PGUSER: ${{ secrets.PGUSER }}
109+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
110+
PGDATABASE: ckbtest
73111
env:
74112
RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }}

‎.github/workflows/ci_cargo_deny_ubuntu.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,40 @@ jobs:
5757
- uses: actions/checkout@v2
5858
- name: ci_cargo_deny_ubuntu
5959
run: |
60+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
61+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
62+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
6063
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
6164
devtools/ci/ci_main.sh
6265
else
6366
echo "skip job"
6467
exit 0
6568
fi
69+
- name: Set test state when success
70+
if: ${{ success() }}
71+
run: |
72+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
73+
shell: bash
74+
- name: Set test state when test failed.
75+
if: ${{ failure() }}
76+
run: |
77+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
78+
shell: bash
79+
- name: insert data to DB
80+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
81+
run: |
82+
if [[ ! -z "${{ env.PGHOST }}" ]];then
83+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
84+
echo $end_time
85+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
86+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','ubuntu','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
87+
fi
88+
shell: bash
89+
env:
90+
PGHOST: ${{ secrets.PGHOST }}
91+
PGPORT: ${{ secrets.PGPORT }}
92+
PGUSER: ${{ secrets.PGUSER }}
93+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
94+
PGDATABASE: ckbtest
6695
env:
6796
RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }}

‎.github/workflows/ci_integration_tests_macos.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,42 @@ jobs:
5757
steps:
5858
- uses: actions/checkout@v2
5959
- run: |
60+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV
61+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
62+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
6063
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
6164
devtools/ci/ci_main.sh
6265
else
6366
echo "skip job"
6467
exit 0
6568
fi
6669
shell: bash
70+
- name: Set test state when success
71+
if: ${{ success() }}
72+
run: |
73+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
74+
shell: bash
75+
- name: Set test state when test failed.
76+
if: ${{ failure() }}
77+
run: |
78+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
79+
shell: bash
80+
- name: insert data to DB
81+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
82+
run: |
83+
if [[ ! -z "${{ env.PGHOST }}" ]];then
84+
end_time=$(date +%Y-%m-%d' '%H:%M:%S)
85+
echo $end_time
86+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
87+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','macOS','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
88+
fi
89+
shell: bash
90+
env:
91+
PGHOST: ${{ secrets.PGHOST }}
92+
PGPORT: ${{ secrets.PGPORT }}
93+
PGUSER: ${{ secrets.PGUSER }}
94+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
95+
PGDATABASE: ckbtest
6796
- name: upload log files
6897
if: always()
6998
uses: actions/upload-artifact@v2

‎.github/workflows/ci_integration_tests_ubuntu.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,42 @@ jobs:
5858
steps:
5959
- uses: actions/checkout@v2
6060
- run: |
61+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
62+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
63+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
6164
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
6265
devtools/ci/ci_main.sh
6366
else
6467
echo "skip job"
6568
exit 0
6669
fi
6770
shell: bash
71+
- name: Set test state when success
72+
if: ${{ success() }}
73+
run: |
74+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
75+
shell: bash
76+
- name: Set test state when test failed.
77+
if: ${{ failure() }}
78+
run: |
79+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
80+
shell: bash
81+
- name: insert data to DB
82+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
83+
run: |
84+
if [[ ! -z "${{ env.PGHOST }}" ]];then
85+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
86+
echo $end_time
87+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
88+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','ubuntu','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
89+
fi
90+
shell: bash
91+
env:
92+
PGHOST: ${{ secrets.PGHOST }}
93+
PGPORT: ${{ secrets.PGPORT }}
94+
PGUSER: ${{ secrets.PGUSER }}
95+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
96+
PGDATABASE: ckbtest
6897
- name: upload log files
6998
if: always()
7099
uses: actions/upload-artifact@v2

‎.github/workflows/ci_integration_tests_windows.yaml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,52 @@ jobs:
6666
scoop install git
6767
scoop bucket add extras
6868
scoop install llvm yasm
69+
$pgService = Get-Service -Name postgresql*
70+
Set-Service -InputObject $pgService -Status running -StartupType automatic
71+
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
6972
- run: |
73+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV
74+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
75+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
7076
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
7177
devtools/ci/ci_main.sh
7278
else
7379
echo "skip job"
7480
exit 0
7581
fi
7682
shell: bash
83+
- name: Set test state when success
84+
if: ${{ success() }}
85+
run: |
86+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
87+
shell: bash
88+
- name: Set test state when test failed.
89+
if: ${{ failure() }}
90+
run: |
91+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
92+
shell: bash
93+
- name: insert data to DB
94+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
95+
run: |
96+
if [[ ! -z "${{ env.PGHOST }}" ]];then
97+
end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N)
98+
sql="INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
99+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','windows','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
100+
echo $RUNNER_LABEL
101+
if [[ $RUNNER_LABEL == 'windows-2019' ]];then
102+
echo "github action"
103+
"$PGBIN\psql" -c "$sql"
104+
else
105+
psql -c "$sql"
106+
fi
107+
fi
108+
shell: bash
109+
env:
110+
PGHOST: ${{ secrets.PGHOST }}
111+
PGPORT: ${{ secrets.PGPORT }}
112+
PGUSER: ${{ secrets.PGUSER }}
113+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
114+
PGDATABASE: ckbtest
77115
- name: upload log files
78116
if: always()
79117
uses: actions/upload-artifact@v2

‎.github/workflows/ci_linters_macos.yaml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,38 @@ jobs:
5555
- uses: actions/checkout@v2
5656
- run: |
5757
brew install grep gnu-sed
58+
echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV
59+
echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV
60+
echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV
5861
if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then
5962
devtools/ci/ci_main.sh
6063
else
6164
echo "skip job"
6265
exit 0
6366
fi
6467
shell: bash
68+
- name: Set test state when success
69+
if: ${{ success() }}
70+
run: |
71+
echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV
72+
- name: Set test state when test failed.
73+
if: ${{ failure() }}
74+
run: |
75+
echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV
76+
- name: insert data to DB
77+
if: ${{ always() && github.repository_owner == 'nervosnetwork'}}
78+
run: |
79+
if [[ ! -z "${{ env.PGHOST }}" ]];then
80+
end_time=$(date +%Y-%m-%d' '%H:%M:%S)
81+
echo $end_time
82+
psql -c "INSERT INTO ci (github_run_name,github_run_id,github_run_state,start_time,end_time,github_branch,github_trigger_event,github_repo_owner,github_pr_number,github_commit_id,github_commit_time,github_action_run_os,github_run_link) \
83+
VALUES ('$GITHUB_WORKFLOW','$GITHUB_RUN_ID','${{ env.GITHUB_RUN_STATE }}','${{ env.START_TIME }}','$end_time','${{ github.ref_name }}','${{github.event_name }}','${{ github.repository_owner }}','${{github.event.number}}','${{ env.CKB_COMMIT_ID }}','${{ env.CKB_COMMIT_TIME}}','macOS','https://github.com/${{ github.repository }}actions/runs/${{ github.run_id }}');"
84+
fi
85+
env:
86+
PGHOST: ${{ secrets.PGHOST }}
87+
PGPORT: ${{ secrets.PGPORT }}
88+
PGUSER: ${{ secrets.PGUSER }}
89+
PGPASSWORD: ${{ secrets.PGPASSWORD }}
90+
PGDATABASE: ckbtest
6591
env:
6692
RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }}

0 commit comments

Comments
 (0)