Skip to content

feat(runtimes): Deno canary #34721

feat(runtimes): Deno canary

feat(runtimes): Deno canary #34721

name: optional-test
on:
# Note about push & pull_request
# when creating a new branch for a PR, push will be triggered immediately before the PR gets created
# The GitHub API / GitHub context base commit is then 0000000000000000000000000000000000000000
#
# The get-changed-files action used in the detect_jobs_to_run needs to have a non 0 base commit to ba able to diff
# Defining both push (and specify the branches) and pull_request solves the problem
push:
branches:
# Push events our default branch
- dev
# Push events on our special branches
- patch-dev
- latest
- integration
pull_request:
paths-ignore:
- '*.md'
- 'renovate.json'
env:
PRISMA_TELEMETRY_INFORMATION: 'ecosystem-tests optional-test.yaml'
# To hide "Update available x.y.z -> x.y.z"
PRISMA_HIDE_UPDATE_MESSAGE: true
SLACK_WEBHOOK_URL_WORKFLOWS: ${{ secrets.SLACK_WEBHOOK_URL_OPTIONAL_WORKFLOWS }}
CI: 1
# TODO: Consolidate these env vars. They shouldn't be required for slack notification
# They are only required because `test-project.sh` hardcodes the names
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_OPTIONAL_TESTS_SUCCESS }}
SLACK_WEBHOOK_URL_FAILING: ${{ secrets.SLACK_WEBHOOK_URL_OPTIONAL_TESTS_FAILING }}
##
SLACK_WEBHOOK_URL_OPTIONAL_TESTS_SUCCESS: ${{ secrets.SLACK_WEBHOOK_URL_OPTIONAL_TESTS_SUCCESS }}
SLACK_WEBHOOK_URL_OPTIONAL_TESTS_FAILING: ${{ secrets.SLACK_WEBHOOK_URL_OPTIONAL_TESTS_FAILING }}
defaults:
run:
# this makes windows use bash as well, which makes `... >> $GITHUB_ENV` work there
shell: bash
jobs:
# Depending on the output we will run some or all tests as fallback
detect_jobs_to_run:
name: Detect jobs to run
runs-on: ubuntu-22.04
outputs:
jobs: ${{ steps.detect.outputs.jobs }}
steps:
- id: checkout
uses: actions/checkout@v4
- id: files
uses: Ana06/[email protected] # it's a fork of jitterbit/get-changed-files@v1 which works better with pull requests
with:
format: 'json'
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 16
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- id: detect
run: ./.github/workflows/scripts/detect-jobs-to-run.js <<<'${{ steps.files.outputs.all }}'
report-to-slack-success:
runs-on: ubuntu-22.04
needs:
- community-generators
if: success() && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/integration' || github.ref == 'refs/heads/patch-dev' || github.ref == 'refs/heads/latest')
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: report success to slack
run: bash .github/scripts/slack-workflow-status.sh "(Optional tests) :white_check_mark:"
report-to-slack-failure:
runs-on: ubuntu-22.04
needs:
- community-generators
if: failure() && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/integration' || github.ref == 'refs/heads/patch-dev' || github.ref == 'refs/heads/latest')
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: report failure to slack
run: bash .github/scripts/slack-workflow-status.sh "(Optional tests) :x:"
community-generators:
needs: [detect_jobs_to_run]
if: contains(fromJSON(needs.detect_jobs_to_run.outputs.jobs), 'community-generators')
strategy:
fail-fast: false
matrix:
generator: [prisma-dbml-generator, typegraphql-prisma, prisma-json-schema-generator, prisma-nestjs-graphql]
clientEngine: ['library', 'binary']
runs-on: ubuntu-22.04
env:
DB_URL_COMMUNITY_GENERATOR_TYPEGRAPHQL_PRISMA: ${{ secrets.DB_URL_COMMUNITY_GENERATOR_TYPEGRAPHQL_PRISMA }}
steps:
- uses: actions/checkout@v4
- name: Define Client Engine Type to test
run: echo "PRISMA_CLIENT_ENGINE_TYPE=${{ matrix.clientEngine }}" >> $GITHUB_ENV
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 16
cache: 'pnpm'
cache-dependency-path: ${{ github.job }}/${{ matrix.generator }}/pnpm-lock.yaml
- name: Install Dependencies
run: pnpm install
- name: test ${{ matrix.generator }} - ${{matrix.clientEngine}}
id: run-test
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: bash .github/scripts/test-project.sh ${{ github.job }} ${{ matrix.generator }}
- name: notify-slack
if: failure()
run: bash .github/slack/notify-failure.sh ${{ github.job }} ${{ matrix.generator }}