From 7eddd6ce55177eb888575219e489627e1b396486 Mon Sep 17 00:00:00 2001 From: liya2017 Date: Mon, 24 Jan 2022 14:41:22 +0800 Subject: [PATCH] add ci monitoring --- .github/workflows/ci_benchmarks_macos.yaml | 30 ++++++++++++++ .github/workflows/ci_benchmarks_ubuntu.yaml | 32 ++++++++++++++- .github/workflows/ci_benchmarks_windows.yaml | 35 +++++++++++++++++ .github/workflows/ci_cargo_deny_ubuntu.yaml | 3 ++ .../workflows/ci_integration_tests_macos.yaml | 30 ++++++++++++++ .../ci_integration_tests_ubuntu.yaml | 30 ++++++++++++++ .../ci_integration_tests_windows.yaml | 35 +++++++++++++++++ .github/workflows/ci_linters_macos.yaml | 28 ++++++++++++- .github/workflows/ci_linters_ubuntu.yaml | 27 +++++++++++++ .github/workflows/ci_quick_checks_macos.yaml | 27 +++++++++++++ .github/workflows/ci_quick_checks_ubuntu.yaml | 27 +++++++++++++ .github/workflows/ci_unit_tests_macos.yaml | 31 +++++++++++++++ .github/workflows/ci_unit_tests_ubuntu.yaml | 33 +++++++++++++++- .github/workflows/ci_unit_tests_windows.yaml | 39 ++++++++++++++++++- .github/workflows/ci_wasm_build_ubuntu.yaml | 30 ++++++++++++++ 15 files changed, 433 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_benchmarks_macos.yaml b/.github/workflows/ci_benchmarks_macos.yaml index 8fb05899c4..e8f38158ba 100644 --- a/.github/workflows/ci_benchmarks_macos.yaml +++ b/.github/workflows/ci_benchmarks_macos.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,32 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }} diff --git a/.github/workflows/ci_benchmarks_ubuntu.yaml b/.github/workflows/ci_benchmarks_ubuntu.yaml index 8f5159bfd5..2618e00c9c 100644 --- a/.github/workflows/ci_benchmarks_ubuntu.yaml +++ b/.github/workflows/ci_benchmarks_ubuntu.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,32 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: - RUNNER_LABEL: ${{ needs.prologue.outputs.linux_runner_label }} + RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} diff --git a/.github/workflows/ci_benchmarks_windows.yaml b/.github/workflows/ci_benchmarks_windows.yaml index 8c72192cbd..fa6b0d9347 100644 --- a/.github/workflows/ci_benchmarks_windows.yaml +++ b/.github/workflows/ci_benchmarks_windows.yaml @@ -59,10 +59,17 @@ jobs: iex (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "${{ github.workspace }}\devtools\windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + scoop install https://raw.githubusercontent.com/ScoopInstaller/Versions/master/bucket/7zip-zstd.json scoop install git scoop bucket add extras scoop install llvm yasm + $pgService = Get-Service -Name postgresql* + Set-Service -InputObject $pgService -Status running -StartupType automatic + Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -70,5 +77,33 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + echo $PGBIN + "$PGBIN\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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} diff --git a/.github/workflows/ci_cargo_deny_ubuntu.yaml b/.github/workflows/ci_cargo_deny_ubuntu.yaml index b68eb21f93..0764dcfa33 100644 --- a/.github/workflows/ci_cargo_deny_ubuntu.yaml +++ b/.github/workflows/ci_cargo_deny_ubuntu.yaml @@ -57,6 +57,9 @@ jobs: - uses: actions/checkout@v2 - name: ci_cargo_deny_ubuntu run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else diff --git a/.github/workflows/ci_integration_tests_macos.yaml b/.github/workflows/ci_integration_tests_macos.yaml index 7a118a0ae6..c8e27f67f9 100644 --- a/.github/workflows/ci_integration_tests_macos.yaml +++ b/.github/workflows/ci_integration_tests_macos.yaml @@ -57,6 +57,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -64,6 +67,33 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest - name: upload log files if: always() uses: actions/upload-artifact@v2 diff --git a/.github/workflows/ci_integration_tests_ubuntu.yaml b/.github/workflows/ci_integration_tests_ubuntu.yaml index de807dc6aa..3d2ccb9d48 100644 --- a/.github/workflows/ci_integration_tests_ubuntu.yaml +++ b/.github/workflows/ci_integration_tests_ubuntu.yaml @@ -58,6 +58,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -65,6 +68,33 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest - name: upload log files if: always() uses: actions/upload-artifact@v2 diff --git a/.github/workflows/ci_integration_tests_windows.yaml b/.github/workflows/ci_integration_tests_windows.yaml index 56d10ef2c0..4eb2e270fa 100644 --- a/.github/workflows/ci_integration_tests_windows.yaml +++ b/.github/workflows/ci_integration_tests_windows.yaml @@ -63,10 +63,17 @@ jobs: iex (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "${{ github.workspace }}\devtools\windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + scoop install https://raw.githubusercontent.com/ScoopInstaller/Versions/master/bucket/7zip-zstd.json scoop install git scoop bucket add extras scoop install llvm yasm + $pgService = Get-Service -Name postgresql* + Set-Service -InputObject $pgService -Status running -StartupType automatic + Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -74,6 +81,34 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + echo $PGBIN + "$PGBIN\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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest - name: upload log files if: always() uses: actions/upload-artifact@v2 diff --git a/.github/workflows/ci_linters_macos.yaml b/.github/workflows/ci_linters_macos.yaml index 2e7efc68e1..7393a8b847 100644 --- a/.github/workflows/ci_linters_macos.yaml +++ b/.github/workflows/ci_linters_macos.yaml @@ -54,7 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | - brew install grep gnu-sed + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -62,5 +64,29 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S) + echo $end_time + 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) \ + 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 }}');" + fi + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }} diff --git a/.github/workflows/ci_linters_ubuntu.yaml b/.github/workflows/ci_linters_ubuntu.yaml index 2300133d18..77835fb90f 100644 --- a/.github/workflows/ci_linters_ubuntu.yaml +++ b/.github/workflows/ci_linters_ubuntu.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,29 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.linux_runner_label }} diff --git a/.github/workflows/ci_quick_checks_macos.yaml b/.github/workflows/ci_quick_checks_macos.yaml index 22a198b3b3..bb38e519c0 100644 --- a/.github/workflows/ci_quick_checks_macos.yaml +++ b/.github/workflows/ci_quick_checks_macos.yaml @@ -55,6 +55,9 @@ jobs: - uses: actions/checkout@v2 - run: | brew install grep gnu-sed + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -62,5 +65,29 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S) + echo $end_time + 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) \ + 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 }}');" + fi + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }} diff --git a/.github/workflows/ci_quick_checks_ubuntu.yaml b/.github/workflows/ci_quick_checks_ubuntu.yaml index 80e860644c..b7ac32bc3e 100644 --- a/.github/workflows/ci_quick_checks_ubuntu.yaml +++ b/.github/workflows/ci_quick_checks_ubuntu.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,29 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }} diff --git a/.github/workflows/ci_unit_tests_macos.yaml b/.github/workflows/ci_unit_tests_macos.yaml index 716208f81d..4267b9ce6a 100644 --- a/.github/workflows/ci_unit_tests_macos.yaml +++ b/.github/workflows/ci_unit_tests_macos.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,33 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }} + diff --git a/.github/workflows/ci_unit_tests_ubuntu.yaml b/.github/workflows/ci_unit_tests_ubuntu.yaml index a6f245c09a..6bd0c51bae 100644 --- a/.github/workflows/ci_unit_tests_ubuntu.yaml +++ b/.github/workflows/ci_unit_tests_ubuntu.yaml @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -61,5 +64,33 @@ jobs: exit 0 fi shell: bash + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: - RUNNER_LABEL: ${{ needs.prologue.outputs.linux_runner_label }} + RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} + diff --git a/.github/workflows/ci_unit_tests_windows.yaml b/.github/workflows/ci_unit_tests_windows.yaml index 852335e794..c253915c01 100644 --- a/.github/workflows/ci_unit_tests_windows.yaml +++ b/.github/workflows/ci_unit_tests_windows.yaml @@ -59,10 +59,17 @@ jobs: iex (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "${{ github.workspace }}\devtools\windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + scoop install https://raw.githubusercontent.com/ScoopInstaller/Versions/master/bucket/7zip-zstd.json scoop install git scoop bucket add extras scoop install llvm yasm + $pgService = Get-Service -Name postgresql* + Set-Service -InputObject $pgService -Status running -StartupType automatic + Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru - run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else @@ -70,5 +77,35 @@ jobs: exit 0 fi shell: bash + env: + RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + echo $PGBIN + "$PGBIN\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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: - RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} + RUNNER_LABEL: ${{ needs.prologue.outputs.windows_runner_label }} \ No newline at end of file diff --git a/.github/workflows/ci_wasm_build_ubuntu.yaml b/.github/workflows/ci_wasm_build_ubuntu.yaml index 61f3294c23..1941d4666c 100644 --- a/.github/workflows/ci_wasm_build_ubuntu.yaml +++ b/.github/workflows/ci_wasm_build_ubuntu.yaml @@ -57,12 +57,42 @@ jobs: - uses: actions/checkout@v2 - name: ci_wasm_build_ubuntu run: | + echo "START_TIME=$(date +%Y-%m-%d' '%H:%M:%S.%6N)" >> $GITHUB_ENV + echo "CKB_COMMIT_ID=$(git describe --dirty --always --match _EXCLUDE__ --abbrev=7)" >> $GITHUB_ENV + echo "CKB_COMMIT_TIME=$(git log -1 --date=iso "--pretty=format:%cd" | cut -d ' ' -f 1,2)" >> $GITHUB_ENV if [[ ${{ needs.prologue.outputs.os_skip }} == run ]] && [[ ${{ needs.prologue.outputs.job_skip }} == run ]];then devtools/ci/ci_main.sh else echo "skip job" exit 0 fi + - name: Set test state when success + if: ${{ success() }} + run: | + echo "GITHUB_RUN_STATE=0" >> $GITHUB_ENV + shell: bash + - name: Set test state when test failed. + if: ${{ failure() }} + run: | + echo "GITHUB_RUN_STATE=1" >> $GITHUB_ENV + shell: bash + - name: insert data to DB + # if: ${{ always() && github.repository_owner == 'nervosnetwork'}} + if: ${{ always() }} + run: | + if [[ ! -z "${{ env.PGHOST }}" ]];then + end_time=$(date +%Y-%m-%d' '%H:%M:%S.%6N) + echo $end_time + 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) \ + 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 }}');" + fi + shell: bash + env: + PGHOST: ${{ secrets.PGHOST }} + PGPORT: ${{ secrets.PGPORT }} + PGUSER: ${{ secrets.PGUSER }} + PGPASSWORD: ${{ secrets.PGPASSWORD }} + PGDATABASE: ckbtest env: RUNNER_LABEL: ${{ needs.prologue.outputs.runner_label }}