feat!: rename Java packages #4156
Workflow file for this run
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: Validation | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main, '2.5', '2.4', '2.3', '2.2', '1.4', '1.3' ] | |
paths-ignore: | |
- 'hilla-logo.svg' | |
- 'README.md' | |
- '.github/ISSUE_TEMPLATE/*' | |
- 'packages/**/README.md' | |
- 'scripts/generator/templates/**/*.md' | |
pull_request_target: | |
types: [opened, synchronize, reopened, edited] | |
paths-ignore: | |
- 'hilla-logo.svg' | |
- 'README.md' | |
- '.github/ISSUE_TEMPLATE/*' | |
- 'packages/**/README.md' | |
- 'scripts/generator/templates/**/*.md' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
init: | |
name: Build Java and TypeScript for other tasks | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
env: | |
NX_SKIP_NX_CACHE: true | |
steps: | |
- uses: actions-cool/check-user-permission@main | |
id: checkUser | |
with: | |
username: ${{github.triggering_actor}} | |
require: 'write' | |
- name: Fail on external workflow triggering | |
if: ${{ steps.checkUser.outputs.require-result != 'true' && github.actor != 'dependabot[bot]' }} | |
run: | | |
echo "🚫 **${{ github.actor }}** is an external contributor, a **${{ github.repository }}** team member has to review this changes and re-run this build" \ | |
| tee -a $GITHUB_STEP_SUMMARY && exit 1 | |
- name: Check secrets | |
run: | | |
[ -z "${{secrets.TB_LICENSE}}" ] \ | |
&& echo "🚫 **TB_LICENSE** is not defined, check that **${{github.repository}}** repo has a valid secret" \ | |
| tee -a $GITHUB_STEP_SUMMARY && exit 1 || exit 0 | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Build TypeScript | |
run: npm run build | |
- name: Build Java | |
run: mvn install -B -ntp -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true | |
- name: Save Workspace | |
run: | | |
tar cf workspace.tar -C ~/ $( \ | |
mvn -q -DskipTests \ | |
-Dexec.executable='echo' \ | |
-Dexec.args='${project.groupId}:${project.artifactId}' \ | |
-Dexec.skip='${maven.deploy.skip}' \ | |
exec:exec \ | |
| perl -pe 's/\.(?=.*:)/\//g' \ | |
| sed -e 's/:/\//' \ | |
| sed -e 's/^/.m2\/repository\//' \ | |
) | |
find packages/java -type d -name target -print0 | xargs -0 tar rf workspace.tar | |
tar rf workspace.tar $(find packages/ts -name node_modules -prune -o -print | git check-ignore --stdin) | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: saved-workspace | |
path: workspace.tar | |
retention-days: 1 | |
if-no-files-found: error | |
check-style: | |
needs: init | |
name: Check style | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v3 | |
with: | |
name: saved-workspace | |
- name: Restore Workspace | |
run: | | |
set -x | |
tar xf workspace.tar | |
tar cf - .m2 | (cd ~ && tar xf -) | |
- name: Validate Java Format | |
run: mvn -B formatter:validate | |
- name: Lint TypeScript | |
run: npm run check | |
test-java: | |
needs: init | |
name: Test Java | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v3 | |
with: | |
name: saved-workspace | |
- name: Restore Workspace | |
run: | | |
set -x | |
tar xf workspace.tar | |
tar cf - .m2 | (cd ~ && tar xf -) | |
- name: Test | |
run: mvn -B -am -P\!it-modules verify -pl '!:hilla-gradle-plugin' | |
- name: Collect Coverage | |
run: | | |
COVFILES=$(find packages/java -wholename 'target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed '$s/,$//') | |
echo "COVFILES=$COVFILES" >> $GITHUB_ENV | |
- name: Send Coverage to Codecov | |
if: ${{ env.COVFILES != '' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ env.COVFILES }} | |
flags: unittests | |
fail_ci_if_error: true | |
root_dir: ${{ github.workspace }} | |
test-typescript: | |
needs: init | |
name: Test TypeScript | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Install Chrome | |
uses: browser-actions/setup-chrome@v1 | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v3 | |
with: | |
name: saved-workspace | |
- name: Restore Workspace | |
run: | | |
set -x | |
tar xf workspace.tar | |
tar cf - .m2 | (cd ~ && tar xf -) | |
- name: Test | |
run: npm run test:coverage | |
env: | |
CI: true | |
- name: Collect Coverage | |
run: | | |
COVFILES=$(find packages/ts -wholename '*/.coverage/lcov.info' | tr '\n' ',' | sed '$s/,$//') | |
echo "COVFILES=$COVFILES" >> $GITHUB_ENV | |
- name: Send Coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ env.COVFILES }} | |
flags: unittests | |
fail_ci_if_error: true | |
root_dir: ${{ github.workspace }} | |
test-it: | |
needs: | |
- init | |
name: ITs | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
it-modules: group-1 | |
- os: ubuntu-latest | |
it-modules: group-2 | |
- os: windows-latest | |
it-modules: some | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v3 | |
with: | |
name: saved-workspace | |
- name: Restore Workspace | |
run: | | |
set -x | |
tar xf workspace.tar | |
tar cf - .m2 | (cd ~ && tar xf -) | |
- name: Set TB License | |
run: | | |
TB_LICENSE=${{secrets.TB_LICENSE}} | |
mkdir -p ~/.vaadin/ | |
echo '{"username":"'`echo $TB_LICENSE | cut -d / -f1`'","proKey":"'`echo $TB_LICENSE | cut -d / -f2`'"}' > ~/.vaadin/proKey | |
- name: Verify | |
run: | | |
( | |
cd packages/java/tests && \ | |
mvn -B -am -ntp -fae \ | |
-Dfailsafe.forkCount=4 \ | |
-Dcom.vaadin.testbench.Parameters.testsInParallel=5 \ | |
-Dfailsafe.rerunFailingTestsCount=2 \ | |
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25 \ | |
-Dmaven.wagon.http.retryHandler.count=3 \ | |
-P\!it-modules \ | |
-Pit-modules-${{ matrix.it-modules }} \ | |
-Pproduction \ | |
verify | |
) | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() || success() }} | |
with: | |
name: saved-outputs | |
path: | | |
packages/java/tests/**/target/*-reports/* | |
packages/java/tests/**/error-screenshots/*.png | |
test-gradle: | |
needs: | |
- init | |
name: Gradle tests | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Project Code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- uses: actions/download-artifact@v3 | |
with: | |
name: saved-workspace | |
- name: Restore Workspace | |
run: | | |
set -x | |
tar xf workspace.tar | |
tar cf - .m2 | (cd ~ && tar xf -) | |
- name: Set TB License | |
run: | | |
TB_LICENSE=${{secrets.TB_LICENSE}} | |
mkdir -p ~/.vaadin/ | |
echo '{"username":"'`echo $TB_LICENSE | cut -d / -f1`'","proKey":"'`echo $TB_LICENSE | cut -d / -f2`'"}' > ~/.vaadin/proKey | |
- name: Test gradle-plugin's functional tests | |
run: ./packages/java/gradle-plugin/gradlew --info -p packages/java/gradle-plugin functionalTest | |
- name: Gradle ITs | |
run: ./packages/java/tests/gradle/single-module-tests/gradlew --info -p packages/java/tests/gradle/single-module-tests test | |
- uses: actions/upload-artifact@v3 | |
if: ${{ failure() || success() }} | |
with: | |
name: saved-outputs-gradle | |
path: | | |
packages/java/tests/**/target/*-reports/* | |
packages/java/tests/**/error-screenshots/*.png | |
test-all: | |
name: Tests Summary | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
- check-style | |
- test-java | |
- test-typescript | |
- test-it | |
- test-gradle | |
steps: | |
- name: Fail if test jobs did not succeed | |
if: ${{ needs.check-style.result != 'success' || needs.test-java.result != 'success' || needs.test-typescript.result != 'success' || needs.test-it.result != 'success' || needs.test-gradle.result != 'success' }} | |
run: exit 1 |