|
| 1 | +name: Test Dependabot PRs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'dependabot/**' |
| 7 | + |
| 8 | +jobs: |
| 9 | + gradle_check: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + gradle_detected: ${{ steps.gradle-check.outputs.gradle_detected }} |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Check for build.gradle.kts |
| 18 | + id: gradle-check |
| 19 | + run: | |
| 20 | + if [ -f "build.gradle.kts" ]; then |
| 21 | + echo "Detected build.gradle.kts" |
| 22 | + echo "gradle_detected=true" >> $GITHUB_OUTPUT |
| 23 | + else |
| 24 | + echo "No build.gradle.kts found" |
| 25 | + echo "gradle_detected=false" >> $GITHUB_OUTPUT |
| 26 | + fi |
| 27 | +
|
| 28 | + npm_check: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + outputs: |
| 31 | + npm_detected: ${{ steps.npm-check.outputs.npm_detected }} |
| 32 | + steps: |
| 33 | + - name: Checkout repository |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Check for package.json |
| 37 | + id: npm-check |
| 38 | + run: | |
| 39 | + if [ -f "package.json" ]; then |
| 40 | + echo "Detected package.json" |
| 41 | + echo "npm_detected=true" >> $GITHUB_OUTPUT |
| 42 | + else |
| 43 | + echo "No package.json found" |
| 44 | + echo "npm_detected=false" >> $GITHUB_OUTPUT |
| 45 | + fi |
| 46 | +
|
| 47 | + build_gradle: |
| 48 | + needs: [gradle_check] |
| 49 | + if: needs.gradle_check.outputs.gradle_detected == 'true' |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - uses: actions/setup-java@v4 |
| 54 | + with: |
| 55 | + distribution: temurin |
| 56 | + java-version: 17 |
| 57 | + |
| 58 | + |
| 59 | + env: |
| 60 | + ORG_GRADLE_PROJECT_githubUser: x-access-token |
| 61 | + ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + with: |
| 63 | + arguments: --configuration-cache test |
| 64 | + |
| 65 | + build_npm: |
| 66 | + needs: [npm_check] |
| 67 | + if: needs.npm_check.outputs.npm_detected == 'true' |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/setup-node@v4 |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + node-version: "18.x" |
| 74 | + |
| 75 | + - name: Cache node_modules |
| 76 | + uses: actions/cache@v3 |
| 77 | + with: |
| 78 | + path: ./node_modules |
| 79 | + key: modules-${{ hashFiles('package-lock.json') }} |
| 80 | + |
| 81 | + - run: npm build |
| 82 | + - run: npm test |
0 commit comments