Test All Samples #532
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 All Samples | |
on: | |
merge_group: | |
schedule: | |
- cron: '30 1 * * *' | |
workflow_dispatch: {} | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'scripts/.util/tools.json' | |
jobs: | |
smoke: | |
name: Smoke Tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
suite: | |
- 'ca-certificates' | |
- 'dotnet-core' | |
- 'git' | |
- 'go' | |
- 'java' | |
- 'nodejs' | |
- 'php' | |
- 'procfile' | |
- 'python' | |
- 'ruby' | |
- 'web-servers' | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18.x | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache local Gradle repository | |
if: ${{ matrix.suite == 'java' }} | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('java/**/*.gradle*', 'java/**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Cache local Maven repository | |
if: ${{ matrix.suite == 'java' }} | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.m2/wrapper | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', 'java/**/maven-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Setup Directories | |
if: ${{ matrix.suite == 'java' }} | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
mkdir -p ~/.m2/repository | |
mkdir -p ~/.m2/repository/wrapper/dists | |
mkdir -p ~/.gradle/caches | |
mkdir -p ~/.gradle/wrapper/dists | |
chmod -R 775 ~/.m2 | |
chmod -R 775 ~/.gradle | |
- name: Test ${{ matrix.suite }} | |
run: | | |
./scripts/smoke.sh --builder paketobuildpacks/builder:full --suite ${{ matrix.suite }} | |
- name: File Issue | |
if: ${{ failure() && github.event_name != 'pull_request' }} | |
run: | | |
echo "${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}" | gh auth login --with-token | |
failure_issue=$(gh issue list --json number --label "test-failure" --jq .[0].number) | |
if [ -z $failure_issue ]; \ | |
then gh issue create \ | |
--title "Failure: 'Test All Samples' workflow" \ | |
--label "test-failure" \ | |
--body "[Test ${{ matrix.suite }} workflow](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) failed. Please take a look to ensure samples are working. (cc @paketo-buildpacks/content-maintainers)" \ | |
-R ${{github.repository}}; \ | |
else gh issue comment $failure_issue --body "Another failure occurred: [Test ${{ matrix.suite }} workflow](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) failed."; \ | |
fi | |
echo $failure_issue |