Skip to content

Unit Test

Unit Test #219

Workflow file for this run

name: Unit Test
on:
schedule:
- cron: '0 7 * * *'
push:
workflow_call:
jobs:
test:
runs-on: ubuntu-latest
name: Test with ${{ matrix.engine.name }} ${{ matrix.engine.version }}
strategy:
fail-fast: false
matrix:
engine:
- name: ruby
version: '3.4'
- name: ruby
version: '3.3'
- name: ruby
version: '3.2'
- name: ruby
version: '3.1'
- name: ruby
version: '3.0'
- name: ruby
version: '2.7'
- name: ruby
version: '2.6'
- name: ruby
version: '2.5'
- name: jruby
version: '9.4'
- name: jruby
version: '9.3'
- name: jruby
version: '9.2'
container:
image: "ghcr.io/datadog/images-rb/engines/${{ matrix.engine.name }}:${{ matrix.engine.version }}"
steps:
- uses: actions/checkout@v4
- name: Ruby version
run: ruby -v
- name: Gem version
run: gem -v
- name: Bundler version
run: bundler -v
- name: Install dependencies
run: bundler install
- 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/[email protected]
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/[email protected]
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 }}