Test #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
workflow_call: | |
secrets: | |
SLACK_BOT_TOKEN: | |
required: true | |
schedule: | |
- cron: '0 7 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: ruby:${{ matrix.ruby_version }} | |
name: Test ${{ matrix.ruby_version }} | |
strategy: | |
matrix: | |
ruby_version: | |
- '3.3' | |
- '3.2' | |
- '3.1' | |
- '3.0' | |
- '2.7' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fix git | |
# https://github.com/actions/runner/issues/2033 | |
run: chown -R $(id -u):$(id -g) $(pwd) | |
- name: Ruby version | |
run: ruby -v | |
- name: Update gem | |
run: | | |
gem update --system 3.3.27 | |
gem update --system || echo "Fail to update to latest gem version" | |
- name: Gem version | |
run: gem -v | |
- name: Bundler version | |
run: bundle -v | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: bundle exec rake spec | |
- name: Run tests with ITR | |
env: | |
DD_CIVISIBILITY_AGENTLESS_ENABLED: true | |
DD_CIVISIBILITY_ITR_ENABLED: true | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
DD_ENV: ci | |
run: bundle exec rake spec | |
notify: | |
runs-on: ubuntu-latest | |
needs: test | |
if: always() | |
steps: | |
- uses: actions/checkout@v4 | |
- if: ${{ needs.test.result == 'success' }} | |
name: Notify success | |
uses: ./.github/actions/slack | |
with: | |
message: |- | |
:github: ${{ github.repository }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
:github-check: ${{ github.ref_type }}: ${{ github.ref_name }} | |
channel: ${{ vars.SLACK_CHANNEL_ID }} | |
token: ${{ secrets.SLACK_BOT_TOKEN }} | |
- if: ${{ needs.test.result == 'failure' }} | |
uses: ./.github/actions/slack | |
name: Notify failure | |
with: | |
message: |- | |
:github: ${{ github.repository }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
:red-light: ${{ github.ref_type }}: ${{ github.ref_name }} | |
channel: ${{ vars.SLACK_CHANNEL_ID }} | |
token: ${{ secrets.SLACK_BOT_TOKEN }} |