Skip to content

test files

test files #4945

Workflow file for this run

name: Unit Tests
on:
push:
branches: [ '*' ]
pull_request:
branches: [ main ]
schedule:
# Run automatically at 8AM PST Monday-Friday
- cron: '0 15 * * 1-5'
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'go', 'java', 'node', 'php', 'python', 'ruby' ]
runs-on: ubuntu-latest
timeout-minutes: 20
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }}
steps:
- name: Checkout twilio-oai-generator
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Java 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Login to Docker Hub
if: env.DOCKER_LOGIN
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
- name: Run unit tests
run: make test
- name: Run helper tests and sonar analysis
run: make test-docker SONAR_TOKEN=${{ secrets.SONAR_TOKEN }} LANGUAGES=${{ matrix.language }}
- name: Show git status and fail on diff
run: |
git status
git diff
test -z "$(git status --porcelain)"
- name: Remove pom file # Otherwise, the Sonar action fails and recommends using the Maven plugin
run: rm pom.xml
- name: Install SonarCloud scanner and run analysis
uses: SonarSource/sonarcloud-github-action@master
if: (github.event_name == 'pull_request' || github.ref_type == 'branch') && !github.event.pull_request.head.repo.fork && startsWith(matrix.language, 'csharp') != true
with:
projectBaseDir: examples/${{ matrix.language }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
notify-on-failure:
name: Slack notify on failure
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: failure
SLACK_ICON_EMOJI: ':github:'
SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
SLACK_TITLE: Build Failure
SLACK_USERNAME: GitHub Actions
SLACK_MSG_AUTHOR: twilio-dx
SLACK_FOOTER: Posted automatically using GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true