Skip to content

Use correct package for jersey with Jetty 11 #4736

Use correct package for jersey with Jetty 11

Use correct package for jersey with Jetty 11 #4736

name: Tests and Deployments
on:
push:
pull_request:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
functional-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node:
- "21"
- "20"
- "18"
java:
- "17"
- "11"
include:
- node: "18"
java: "11"
ENABLE_CODE_COVERAGE: true
ENABLE_INTEGRATION_TESTS: true
ENABLE_DEPLOYMENT: true
- node: "18"
java: "17"
ENABLE_PACKAGE_TESTS: true
env:
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
RUN_INTEGRATION_TESTS: ${{ matrix.ENABLE_INTEGRATION_TESTS && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags')) }}
RUN_PACKAGE_TESTS: ${{ matrix.ENABLE_PACKAGE_TESTS && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
RUN_DEPLOYMENT: ${{ matrix.ENABLE_DEPLOYMENT && startsWith(github.ref, 'refs/tags') }}
name: Run tests on NodeJS ${{ matrix.node }} and Java ${{ matrix.java }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
- name: Read pnpm version
id: read-pnpm-version
run: echo "version=$(cat .tool-versions | grep pnpm | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ steps.read-pnpm-version.outputs.version }}
- uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: ${{ matrix.java }}
# Starting with Node 17, DNS is resolved by order that the resolver
# returns it. In Github Actions environment, there is a loopback IP
# for ::1 to localhost, which means our tests try to connect to the ipv6
# interface, which the Java program does not listen on.
- name: Remove ipv6 loopback
run: sudo sed -Ei '/(^::1)/d' /etc/hosts
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Apex parsing server
run: pnpm nx run prettier-plugin-apex:start-server &
- name: Wait for Apex parsing server to be up
run: pnpm nx run prettier-plugin-apex:wait-server
- name: Run functional tests
run: AST_COMPARE=true pnpm nx run prettier-plugin-apex:test:standalone
- name: Upload code coverage
if: matrix.ENABLE_CODE_COVERAGE
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Install integration test suite dependencies
if: env.RUN_INTEGRATION_TESTS == 'true'
run: sudo apt-get install -y -qq parallel
# This step is needed because integration tests rely on the
# existence of the compiled JS, as they are run using Node
# instead of tsx
- name: Build the project
if: env.RUN_INTEGRATION_TESTS == 'true'
run: pnpm nx run prettier-plugin-apex:build:dev
- name: Run integration tests
if: env.RUN_INTEGRATION_TESTS == 'true'
run: ./packages/prettier-plugin-apex/tests_integration/format/run-integration-tests.sh
- name: Run package tests
if: env.RUN_PACKAGE_TESTS == 'true'
run: ./packages/prettier-plugin-apex/tests_integration/package/run-package-tests.sh
# npm-publish no longer automatically runs `prepack`, so we have to build
# the Prod bundle manually here
- name: Build Production bundle
if: env.RUN_DEPLOYMENT == 'true'
run: pnpm nx run prettier-plugin-apex:build:prod
- name: Deploy to NPM
if: env.RUN_DEPLOYMENT == 'true'
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Create Release
if: env.RUN_DEPLOYMENT == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- name: Stop Apex parsing server
if: ${{ always() }}
run: pnpm nx run prettier-plugin-apex:stop-server