1 # ---------------------------------------------------------------------------
2 # Multi-Phasic Applications: SquirrelJME
3 # Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
4 # Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
5 # ---------------------------------------------------------------------------
6 # SquirrelJME is under the GNU General Public License v3, or later.
7 # See license.mkd for licensing and copyright information.
8 # ---------------------------------------------------------------------------
9 # DESCRIPTION: CircleCI Build Configuration
10 # SourceForge: squirreljme@frs.sourceforge.net
11 # SourceForge Root: /home/frs/project/squirreljme/AutoBuild/
12 # CircleCI Reference: https://circleci.com/docs/2.0/env-vars/
19 # - image: debian:bookworm
21 image: ubuntu-2204:2024.01.1
24 # Allow Gradle to be fully cached
25 GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
28 # - image: debian:bookworm
30 image: ubuntu-2204:2024.01.1
31 resource_class: arm.medium
33 # Allow Gradle to be fully cached
34 GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
36 # This is in the documentation but does not actually work, new feature?
41 # resource_class: medium
43 # # Use a reduced amount of memory to all the VMs so that it does not
44 # # try grabbing all the memory that is available to the system.
50 resource_class: macos.x86.medium.gen2
52 # Do not auto-update brew as this takes forever, and we really just want
54 HOMEBREW_NO_AUTO_UPDATE: 1
56 # Do not auto-clean brew, this wastes time and everything will be thrown
57 # out when the container finishes anyway
58 HOMEBREW_CLEANUP_MAX_AGE_DAYS: 730
60 # Do not send analytics
61 HOMEBREW_NO_ANALYTICS: 1
63 # Do not clean up after installation
64 HOMEBREW_NO_INSTALL_CLEANUP: 1
68 resource_class: squirreljme/squirreljme-macos-m1
71 win: circleci/windows@5.0
73 # Parameters to simplify commands
75 # Options to be used for any Gradle command, is faster this way
76 standard-gradle-options:
78 default: --console plain --continue --parallel --no-daemon --stacktrace
80 # Standard build for systems
81 standard-build-options:
83 default: build testHosted -x testSpringCoat -x testSpringCoatRelease -x testSpringCoatDebug -x javadoc -x javadocJar -x sourcesJar -x markdownJavaDoc
85 # Commands that are used by almost everything
87 # Save Gradle cache and such so subsequent builds are faster
90 - persist_to_workspace:
99 # Saving of test results, since this is duplicated for many OSes
113 default: ./.no-persist/
119 default: ./.no-persist/
122 shell: <<parameters.shell>>
123 name: Save test results
125 mkdir -p "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/"
126 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/" \;
129 shell: <<parameters.shell>>
130 name: Save test results
132 mkdir -p "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/"
133 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/" \;
136 shell: <<parameters.shell>>
139 mkdir -p "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/"
140 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/" \;
142 - store_test_results:
143 path: <<parameters.store-home>>/test-results
145 path: <<parameters.store-home>>/test-results
147 # Install standard packages in Debian/Ubuntu
148 linux-install-required:
152 command: apt-get update -y && apt-get -y install sudo || echo "Failed, but ignoring..."
154 name: Update package lists
155 command: sudo apt-get update -y
157 name: Install required dependencies
159 sudo apt-get install -y --no-install-recommends cmake build-essential curl wget openjdk-17-jdk gcc g++ make clang git openssh-client
161 # Install required packages on Windows
162 windows-install-required:
167 command: choco install cmake -y
169 # Install what is required by Flatpak
170 flatpak-install-required:
174 command: sudo apt-get install -y flatpak flatpak-builder
176 name: Register Flathub
177 command: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
179 name: Flatpak FreeDesktop Platform
180 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//23.08
182 name: Flatpak FreeDesktop SDK
183 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Sdk//23.08
185 name: Flatpak OpenJDK
186 command: flatpak install --user -y --noninteractive flathub runtime/org.freedesktop.Sdk.Extension.openjdk11//23.08
188 # Flatpak Common Build Rules
189 flatpak-common-build:
195 name: Flatpak Build and Install
196 command: flatpak-builder --user --install --install-deps-from=flathub --allow-missing-runtimes --force-clean build-dir cc.squirreljme.SquirrelJME.yml
199 command: flatpak build-bundle $HOME/.local/share/flatpak/repo squirreljme-<<parameters.arch>>.flatpak cc.squirreljme.SquirrelJME
202 command: ls -al squirreljme-<<parameters.arch>>.flatpak
204 path: squirreljme-<<parameters.arch>>.flatpak
205 destination: squirreljme-<<parameters.arch>>.flatpak
208 ################################## BUNDLE ##################################
210 executor: build-on-linux-amd64
213 - linux-install-required
215 ################################## WINDOWS #################################
222 # Use older JDK for CircleCI
223 JAVA_HOME: c:/users/circleci/project/jdk-11.0.22/
227 name: Download Older JDK
228 command: curl -o /c/users/circleci/jdk.zip https://download.bell-sw.com/java/11.0.22+12/bellsoft-jdk11.0.22+12-windows-amd64.zip
231 name: Extract Older JDK
232 command: unzip /c/users/circleci/jdk.zip
236 command: java -version
237 - persist_to_workspace:
247 # Use a reduced amount of memory to all the VMs so that it does not
248 # try grabbing all the memory that is available to the system.
251 # Use older JDK for CircleCI
252 JAVA_HOME: c:/users/circleci/project/jdk-11.0.22/
257 - windows-install-required
261 command: java -version
264 name: Gradle Build and Test
265 # According to documentation, Gradle on Windows has trouble and tries
266 # to make way too many workers which causes extreme resource.
267 # contention --max-workers=2
268 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
269 no_output_timeout: 60m
272 where: "vm-test-hosted-debug"
277 home: "/c/users/circleci/"
278 store-home: "c:/users/circleci/"
280 where: "vm-test-hosted-release"
285 home: "/c/users/circleci/"
286 store-home: "c:/users/circleci/"
288 build_windows_standalone:
294 # Use a reduced amount of memory to all the VMs so that it does not
295 # try grabbing all the memory that is available to the system.
298 # Use older JDK for CircleCI
299 JAVA_HOME: c:/users/circleci/project/jdk-11.0.22/
304 - windows-install-required
307 name: Construct Standalone
308 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
311 name: Remove distracting JAR, if any
312 command: rm emulators/standalone/build/libs/standalone-*.jar
314 path: emulators/standalone/build/libs/
317 ratufacoat_build_windows:
323 # Use a reduced amount of memory to all the VMs so that it does not
324 # try grabbing all the memory that is available to the system.
330 - windows-install-required
332 name: Setup CMake build
333 working_directory: ratufacoat
336 "$PROGRAMFILES/CMake/bin/cmake.exe" .
338 name: Compile CMake build
339 working_directory: ratufacoat
342 "$PROGRAMFILES/CMake/bin/cmake.exe" --build .
344 path: ratufacoat\src\Debug\SquirrelJME.exe
345 destination: SquirrelJME.exe
347 ################################# MAC OS X #################################
349 executor: build-on-macos
353 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
354 # we do not need that
355 name: Install Dependencies
356 command: brew install openjdk@11 coreutils cmake
358 name: Gradle Build and Test
359 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
360 no_output_timeout: 60m
363 where: "vm-test-hosted-debug"
367 where: "vm-test-hosted-release"
371 executor: build-on-macos-m1
375 name: Gradle Build and Test
376 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
377 no_output_timeout: 60m
380 where: "vm-test-hosted-debug"
384 where: "vm-test-hosted-release"
388 build_macosx_standalone:
389 executor: build-on-macos
393 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
394 # we do not need that
395 name: Install Dependencies
396 command: brew install openjdk@11 coreutils cmake
400 name: Construct Standalone
401 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
403 name: Remove distracting JAR, if any
404 command: rm emulators/standalone/build/libs/standalone-*.jar
406 path: emulators/standalone/build/libs/
408 build_macosx_m1_standalone:
409 executor: build-on-macos-m1
415 name: Construct Standalone
416 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
418 name: Remove distracting JAR, if any
419 command: rm emulators/standalone/build/libs/standalone-*.jar
421 path: emulators/standalone/build/libs/
424 ratufacoat_build_macosx:
425 executor: build-on-macos
430 command: brew install cmake coreutils
434 name: Setup CMake build
435 working_directory: ratufacoat
438 name: Compile CMake build
439 working_directory: ratufacoat
440 command: cmake --build .
442 path: ratufacoat/src/SquirrelJME
443 destination: SquirrelJME
445 ################################### LINUX ##################################
447 executor: build-on-linux-amd64
450 - linux-install-required
452 name: Gradle Build and Test
453 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
454 no_output_timeout: 60m
456 where: "vm-test-hosted-debug"
460 where: "vm-test-hosted-release"
464 build_linux_amd64_standalone:
465 executor: build-on-linux-amd64
468 - linux-install-required
472 name: Construct Standalone
473 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
475 name: Remove distracting JAR, if any
476 command: rm emulators/standalone/build/libs/standalone-*.jar
478 path: emulators/standalone/build/libs/
480 build_linux_amd64_standalone_flatpak:
481 executor: build-on-linux-amd64
484 - linux-install-required
485 - flatpak-install-required
486 - flatpak-common-build:
489 executor: build-on-linux-arm64
492 - linux-install-required
494 name: Gradle Build and Test
495 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
496 no_output_timeout: 60m
498 where: "vm-test-hosted-debug"
502 where: "vm-test-hosted-release"
506 build_linux_arm64_standalone:
507 executor: build-on-linux-arm64
510 - linux-install-required
514 name: Construct Standalone
515 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
517 name: Remove distracting JAR, if any
518 command: rm emulators/standalone/build/libs/standalone-*.jar
520 path: emulators/standalone/build/libs/
522 build_linux_arm64_standalone_flatpak:
523 executor: build-on-linux-arm64
526 - linux-install-required
527 - flatpak-install-required
528 - flatpak-common-build:
531 ### OSS SonaType Nexus
533 executor: build-on-linux-amd64
536 - linux-install-required
540 name: Publish to OSS SonaType
541 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
544 ratufacoat_build_linux:
545 executor: build-on-linux-amd64
548 - linux-install-required
552 name: Setup CMake build
553 working_directory: ratufacoat
556 name: Compile CMake build
557 working_directory: ratufacoat
558 command: cmake --build .
560 path: ratufacoat/src/SquirrelJME
561 destination: SquirrelJME
564 test_springcoat_debug:
565 executor: build-on-linux-amd64
568 - linux-install-required
572 name: SpringCoat Tests
573 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
574 no_output_timeout: 60m
576 where: "vm-test-springcoat-debug"
579 test_springcoat_release:
580 executor: build-on-linux-amd64
583 - linux-install-required
587 name: SpringCoat Tests
588 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
589 no_output_timeout: 60m
591 where: "vm-test-springcoat-release"
596 executor: build-on-linux-amd64
599 - linux-install-required
603 name: SummerCoat Tests
604 command: timeout --foreground 60m ./gradlew testSummerCoat <<pipeline.parameters.standard-gradle-options>>
605 no_output_timeout: 60m
607 where: "vm-test-summercoat-debug"
611 where: "vm-test-summercoat-release"
615 ################################### USERS ##################################
617 executor: build-on-linux-amd64
620 - linux-install-required
623 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
626 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
628 name: Update Git User
630 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
634 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
637 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
641 cd "/tmp/wiki" && git push
643 ################################ CONSTRUCTION ###############################
644 # Runs the `testJar` task so any operations following this will run faster
645 # when they need to use these JARs
647 executor: build-on-linux-amd64
650 - linux-install-required
654 name: Construct Test JARs
655 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
658 # Constructs the ROM fragment libraries for SummerCoat, since they are used
659 # for general ROM construction
660 construct_libSummerCoat:
661 executor: build-on-linux-amd64
664 - linux-install-required
668 name: Construct SummerCoat Libraries
669 command: ./gradlew libSummerCoat <<pipeline.parameters.standard-gradle-options>>
672 # All the tests so that they can run from within SummerCoat
673 construct_libTestSummerCoat:
674 executor: build-on-linux-amd64
677 - linux-install-required
681 name: Construct Test SummerCoat Libraries
682 command: ./gradlew libTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
685 # Constructs the standard SummerCoat ROM, could be uploaded later
686 construct_romSummerCoat:
687 executor: build-on-linux-amd64
690 - linux-install-required
694 name: Construct SummerCoat ROM
695 command: ./gradlew romSummerCoat <<pipeline.parameters.standard-gradle-options>>
698 # Constructs the test SummerCoat ROM, could be uploaded later, this is so
699 # that any RatufaCoats have an actual ROM that can be tested to ensure that
701 construct_romTestSummerCoat:
702 executor: build-on-linux-amd64
705 - linux-install-required
709 name: Construct Test SummerCoat ROM
710 command: ./gradlew romTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
717 ############################# STANDARD TESTS ############################
720 - test_springcoat_debug:
723 - test_springcoat_release:
728 # - construct_libTestSummerCoat
729 - build_linux_amd64_standalone:
732 - build_linux_amd64_standalone_flatpak:
735 - build_linux_arm64_standalone:
738 - build_linux_arm64_standalone_flatpak:
742 # Building on Windows is currently expensive and takes longer, so only
743 # run these builds on trunk to lower costs.
744 # Currently, have an overabundance of credits...
745 - build_windows_setup
748 - build_windows_setup
755 - build_windows_standalone:
759 # Mac OS X runs decently however the jobs for it have a higher cost, so
760 # only perform builds and tests for trunk to lower costs.
761 # Currently, I have an overabundance of credits...
772 - build_macosx_standalone:
775 - build_macosx_m1_standalone:
779 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
789 ###################### LIBRARY AND ROM CONSTRUCTION #####################
790 - construct_testJars:
793 # - construct_libSummerCoat:
795 # - build_linux_amd64
796 # - construct_libTestSummerCoat:
798 # - construct_testJars
799 # - construct_romSummerCoat:
801 # - construct_libSummerCoat
802 # - construct_romTestSummerCoat:
804 # - construct_libTestSummerCoat
806 ############################## RATUFACOAT ##############################
807 # - ratufacoat_build_windows:
810 # - construct_romTestSummerCoat
811 # - ratufacoat_build_linux:
813 # - build_linux_amd64
814 # - construct_romTestSummerCoat
815 # - ratufacoat_build_macosx:
818 # - construct_romTestSummerCoat
820 ############################## DEPLOYMENT ##############################
823 - build_linux_amd64_standalone
824 - build_windows_standalone
825 - build_macosx_standalone
826 - build_macosx_m1_standalone
828 #################### TASKS TO INCREASE USER FRIENDLINESS ####################