From 154ef708abf6d0940fee76b6e60559e9d4e08b77 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Mon, 24 Jun 2024 11:52:43 +0200 Subject: [PATCH] Add scheduled tests --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e553558..ba813c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: Unit Test on: + schedule: + - cron: '0 7 * * *' push: workflow_call: @@ -28,3 +30,31 @@ jobs: bundler-cache: true - name: Run the test run: bundle exec rake test spec + + notify: + runs-on: ubuntu-latest + needs: test + if: always() && github.event_name == 'schedule' + steps: + - if: ${{ needs.test.result == 'success' }} + name: Notify on success + uses: slackapi/slack-github-action@v1.26.0 + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + with: + channel-id: ${{ vars.SLACK_CHANNEL_ID }} + slack-message: |- + :github: ${{ github.repository }}: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + :github-check: ${{ github.ref_type }}: ${{ github.ref_name }} + - if: ${{ needs.test.result == 'failure' }} + name: Notify on failure + uses: slackapi/slack-github-action@v1.26.0 + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + with: + channel-id: ${{ vars.SLACK_CHANNEL_ID }} + slack-message: |- + :github: ${{ github.repository }}: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + :red-light: ${{ github.ref_type }}: ${{ github.ref_name }}