[Rt-commit] 05/07: Add GitHub Actions to run tests on push
Brett Smith
brett at bestpractical.com
Thu Aug 5 20:00:47 UTC 2021
This is an automated email from the git hooks/post-receive script.
brett pushed a commit to branch 5.0/github-actions-tests
in repository rtir.
commit 45771dae8bcf9862745600be2368f5d903314a64
Author: Brett Smith <brett at bestpractical.com>
AuthorDate: Thu Aug 5 13:15:10 2021 -0400
Add GitHub Actions to run tests on push
---
.github/workflows/github-action.yml | 128 ++++++++++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/.github/workflows/github-action.yml b/.github/workflows/github-action.yml
new file mode 100644
index 00000000..1ee5e891
--- /dev/null
+++ b/.github/workflows/github-action.yml
@@ -0,0 +1,128 @@
+on:
+ push:
+ branches-ignore:
+ - maint
+ - stable
+
+jobs:
+ rtir_test_sqlite:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up for tests
+ run: |
+ echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
+ echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
+ - name: Check out RTIR
+ uses: actions/checkout at v2
+ - name: Build test environment
+ run: |
+ docker build --build-arg RT_DB_TYPE=SQLite --build-arg RT_DB_NAME=/var/lib/rt5.db --tag rtir .
+ - name: Run RTIR tests
+ run: |
+ docker run --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make test-parallel'
+ - name: Get run time
+ run: |
+ RT_GA_END_TIME=$(date +%s)
+ RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
+ # Convert seconds to HH::MM::SS
+ RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
+ echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
+ echo RT_GA_END_TIME "$RT_GA_END_TIME"
+ echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
+ echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
+ - name: Post results to Slack
+ if: always()
+ uses: edge/simple-slack-notify at v1.1.1
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
+ with:
+ channel: '#github'
+ status: ${{ job.status }}
+ success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
+ failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
+ cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
+ fields: |
+ [{ "title": "Configuration", "value": "RTIR, SQLite", "short": true },
+ { "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]
+ rtir_test_mariadb:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up for tests
+ run: |
+ echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
+ echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
+ - name: Check out RTIR
+ uses: actions/checkout at v2
+ - name: Build test environment
+ run: |
+ docker network create rt
+ docker run --detach --name rtdb --network rt --env MYSQL_ROOT_PASSWORD=password mariadb:10.3
+ docker build --build-arg RT_DB_TYPE=mysql --build-arg RT_TEST_DB_HOST=rtdb --build-arg RT_TEST_RT_HOST=rtirtest --network rt --tag rtir .
+ - name: Run RTIR tests
+ run: |
+ docker run --name rtirtest --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make test-parallel'
+ - name: Get run time
+ run: |
+ RT_GA_END_TIME=$(date +%s)
+ RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
+ # Convert seconds to HH::MM::SS
+ RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
+ echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
+ echo RT_GA_END_TIME "$RT_GA_END_TIME"
+ echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
+ echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
+ - name: Post results to Slack
+ if: always()
+ uses: edge/simple-slack-notify at v1.1.1
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
+ with:
+ channel: '#github'
+ status: ${{ job.status }}
+ success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
+ failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
+ cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
+ fields: |
+ [{ "title": "Configuration", "value": "RTIR, MariaDB", "short": true },
+ { "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]
+ rtir_test_postgresql:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up for tests
+ run: |
+ echo "RT_BRANCH_NAME=${GITHUB_REF#refs/heads/}" >>"$GITHUB_ENV"
+ echo "RT_GA_START_TIME=$(date +%s)" >>"$GITHUB_ENV"
+ - name: Check out RTIR
+ uses: actions/checkout at v2
+ - name: Build test environment
+ run: |
+ docker network create rt
+ docker run --detach --name rtdb --network rt --mount type=tmpfs,destination=/var/lib/postgresql/data --env POSTGRES_PASSWORD=password postgres:9.6
+ docker build --build-arg RT_DB_TYPE=Pg --build-arg RT_DBA_USER=postgres --build-arg RT_TEST_DB_HOST=rtdb --build-arg RT_TEST_RT_HOST=rtirtest --network rt --tag rtir .
+ - name: Run RTIR tests
+ run: |
+ docker run --name rtirtest --network rt --volume "$GITHUB_WORKSPACE:/rtir" rtir bash -c 'cd /rtir && perl Makefile.PL && make test-parallel'
+ - name: Get run time
+ run: |
+ RT_GA_END_TIME=$(date +%s)
+ RT_GA_TEST_SECS=$(( $RT_GA_END_TIME - ${{ env.RT_GA_START_TIME }} ))
+ # Convert seconds to HH::MM::SS
+ RT_GA_TEST_TIME=$(date -u -d "@$RT_GA_TEST_SECS" +%T)
+ echo RT_GA_START_TIME ${{ env.RT_GA_START_TIME }}
+ echo RT_GA_END_TIME "$RT_GA_END_TIME"
+ echo "RT_GA_END_TIME=$RT_GA_END_TIME" >>"$GITHUB_ENV"
+ echo "RT_GA_TEST_TIME=$RT_GA_TEST_TIME" >>"$GITHUB_ENV"
+ - name: Post results to Slack
+ if: always()
+ uses: edge/simple-slack-notify at v1.1.1
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATIONS }}
+ with:
+ channel: '#github'
+ status: ${{ job.status }}
+ success_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests completed successfully in ${env.RT_GA_TEST_TIME}'
+ failure_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests failed in ${env.RT_GA_TEST_TIME}'
+ cancelled_text: '${env.RT_BRANCH_NAME} (${env.GITHUB_RUN_NUMBER}) tests cancelled in ${env.RT_GA_TEST_TIME}'
+ fields: |
+ [{ "title": "Configuration", "value": "RTIR, PostgreSQL", "short": true },
+ { "title": "URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}?check_suite_focus=true", "short": true }]
--
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.
More information about the rt-commit
mailing list