Skip to content

Basic tests for multifile schemas #3191

Basic tests for multifile schemas

Basic tests for multifile schemas #3191

name: PR Build extension
on:
pull_request:
paths-ignore:
- 'LICENSE'
- 'README.md'
- 'SECURITY.md'
- '.vscode/**'
- '.github/ISSUE_TEMPLATE/**'
- '.github/CODEOWNERS'
env:
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
PRISMA_TELEMETRY_INFORMATION: 'language-tools PR_build_extension.yml'
SLACK_USERNAME: Prismo
SLACK_ICON_EMOJI: ':ship:'
SLACK_MSG_AUTHOR: prisma-bot
jobs:
build:
name: Build extension
# Only runs for Prisma repo, as this will fail on a PR from a fork
if: github.repository == 'prisma/language-tools'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
tag_name: ${{ steps.names.outputs.tag_name }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
# Build the extension
- name: Install Dependencies
run: npm install && npm run bootstrap
- name: Build all packages
run: npm run compile
- name: Replace Readme for marketplace
run: node scripts/change_readme.js dev
- name: Update VS Code extension name
run: |
node scripts/update_package_json_file_PR_build.js
env:
PR_NUMBER: ${{ github.event.number }}
# So we can use the local language server and don't have to publish it to npm first
# Note that linked node_modules are not supported https://github.com/microsoft/vscode-vsce/issues/203
- name: Copy language-server dist directory inside vscode package
run: |
cp -R packages/language-server packages/vscode
rm -R packages/vscode/language-server/src packages/vscode/language-server/test
- name: Build vsix
run: cd packages/vscode && npm run package -- --out=prisma.vsix
# Upload to the current job run
# This is very limited: Only 90 days rentention and cannot get a link easily
- uses: actions/upload-artifact@v4
with:
name: pr-artifact
path: ./packages/vscode/*.vsix
# Add artifact as a commit on the `artifacts` branch
# and post message with the link in the PR
- name: Add artifact to PR
# Skip for Renovate (only build)
if: "!contains(github.actor, 'renovate')"
uses: gavv/pull-request-artifacts@v2.1.0
with:
commit: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-branch: artifacts
artifacts-dir: pull-request-artifacts
artifacts: |
./packages/vscode/prisma.vsix
# Additionally post a comment with a link to GitPod that can use built extension instantly
- name: Find existing comment
if: "!contains(github.actor, 'renovate')"
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'via GitPod'
- name: Create comment
if: "!contains(github.actor, 'renovate') && steps.fc.outputs.comment-id == ''"
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: '[Try this extension build via GitPod](https://gitpod.io/#vsix=https%3A%2F%2Fgithub.com%2Fprisma%2Flanguage-tools%2Fblob%2Fartifacts%2Fpull-request-artifacts%2Fpr${{ github.event.pull_request.number }}-prisma.vsix%3Fraw%3Dtrue/https://github.com/prisma/language-tools-gitpod)'
slack:
name: Send slack notification
runs-on: ubuntu-latest
needs: [build]
if: always() && github.repository == 'prisma/language-tools'
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: ${{ github.event.inputs.branch }}
- name: 'Set current job url in SLACK_FOOTER env var'
if: ${{ always() }}
run: echo "SLACK_FOOTER=<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|Click here to go to the job logs>" >> $GITHUB_ENV
- name: Slack Notification on Failure
if: ${{ failure() || needs.build.result == 'failure' }}
uses: rtCamp/action-slack-notify@v2.3.0
env:
SLACK_TITLE: 'PR Build extension failed :x:'
SLACK_COLOR: '#FF0000'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_FAILURES }}
SLACK_CHANNEL: feed-language-tools-failures