Skip to content

Add pre-commit hook running tests before commit #71

Add pre-commit hook running tests before commit

Add pre-commit hook running tests before commit #71

Workflow file for this run

name: CI
on:
push:
branches: ['*']
pull_request:
branches: [main]
workflow_dispatch:
inputs:
java-version:
description: "Java version (or 'all' for full matrix)"
required: false
default: "11"
jobs:
test:
name: Test - Java ${{ matrix.java }}
runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || 'ubuntu-x64' }}
if: github.repository_owner == 'twilio'
timeout-minutes: 20
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
java: ${{ github.event.inputs.java-version == 'all' && fromJson('[8, 11, 17, 21]') || fromJson(format('[{0}]', github.event.inputs.java-version || '11')) }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
- name: Artifactory OIDC
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: twilio/sdk-actions/artifactory-oidc@4ffc0c647c8d692a8fff24d4f767b207c3d1222e # java_maven
with:
ecosystem: maven
- name: Set up Java
uses: actions/setup-java@e9fbacdec3bb3b6036605a3e6f7995d66773a8c6 # v3.14.2
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven
- run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
- name: Run unit tests
run: mvn test -B
# - name: SonarCloud scan
# if: ${{ matrix.java == 11 && !github.event.pull_request.head.repo.fork && (github.event_name == 'pull_request' || github.ref_type == 'branch') }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=twilio_twilio-java