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
22 resource_class: medium
24 # Allow Gradle to be fully cached
25 GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
27 # Fix Debian package install
28 DEBIAN_FRONTEND: noninteractive
30 NEEDRESTART_SUSPEND: 1
34 # - image: debian:bookworm
36 image: ubuntu-2204:2024.01.1
37 resource_class: arm.medium
39 # Allow Gradle to be fully cached
40 GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
42 # Fix Debian package install
43 DEBIAN_FRONTEND: noninteractive
45 NEEDRESTART_SUSPEND: 1
47 build-on-linux-riscv64:
49 resource_class: squirreljme/squirreljme-linux-riscv64
51 # This is in the documentation but does not actually work, new feature?
56 # resource_class: medium
58 # # Use a reduced amount of memory to all the VMs so that it does not
59 # # try grabbing all the memory that is available to the system.
64 resource_class: squirreljme/squirreljme-macos-x86
68 resource_class: squirreljme/squirreljme-macos-m1
72 resource_class: squirreljme/bundle
75 win: circleci/windows@5.0
77 # Parameters to simplify commands
79 # Options to be used for any Gradle command, is faster this way
80 standard-gradle-options:
82 default: --console plain --continue --parallel --no-daemon --stacktrace
86 default: -x testSpringCoat -x testSpringCoatRelease -x testSpringCoatDebug -x javadoc -x javadocJar -x sourcesJar -x markdownJavaDoc
88 # Standard build for systems
89 standard-build-options:
91 default: build testHosted <<pipeline.parameters.standard-exclusion>>
93 # Windows JDK versions
99 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-i586.zip
102 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-amd64.zip
104 # Commands that are used by almost everything
106 # Save Gradle cache and such so subsequent builds are faster
109 - persist_to_workspace:
118 # Saving of test results, since this is duplicated for many OSes
132 default: ./.no-persist/
138 default: ./.no-persist/
141 shell: <<parameters.shell>>
142 name: Save test results
144 mkdir -p "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/"
145 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/" \;
148 shell: <<parameters.shell>>
149 name: Save test results
151 mkdir -p "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/"
152 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/" \;
155 shell: <<parameters.shell>>
158 mkdir -p "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/"
159 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/" \;
161 - store_test_results:
162 path: <<parameters.store-home>>/test-results
164 path: <<parameters.store-home>>/test-results
166 # Standard apt-get install
167 linux-debian-apt-get-install:
173 name: Install packages
175 DEBIAN_FRONTEND: noninteractive
177 NEEDRESTART_SUSPEND: 1
179 sudo apt-get install -y --no-install-recommends <<parameters.packages>>
181 # Standard apt-get install, optional
182 linux-debian-apt-get-install-optional:
190 name: Install packages (optional)
192 DEBIAN_FRONTEND: noninteractive
194 NEEDRESTART_SUSPEND: 1
196 if ! which "<<parameters.look>>"; then sudo apt-get install -y --no-install-recommends <<parameters.packages>> || echo "Failed, but ignoring..."; fi
198 # Install standard packages in Debian/Ubuntu
199 linux-install-required:
204 DEBIAN_FRONTEND: noninteractive
206 NEEDRESTART_SUSPEND: 1
207 command: apt-get update -y && apt-get -yqq install sudo || echo "Failed, but ignoring..."
209 name: Update package lists
211 DEBIAN_FRONTEND: noninteractive
213 NEEDRESTART_SUSPEND: 1
214 command: sudo apt-get update -y
215 - linux-debian-apt-get-install:
216 packages: cmake build-essential curl wget gcc g++ make clang git openssh-client
217 - linux-debian-apt-get-install-optional:
219 packages: openjdk-17-jdk
220 - linux-debian-apt-get-install-optional:
222 packages: openjdk-11-jdk
223 - linux-debian-apt-get-install-optional:
225 packages: openjdk-8-jdk
226 - linux-debian-apt-get-install-optional:
228 packages: openjdk-7-jdk
230 # Install required packages on Windows
231 windows-install-required:
236 command: choco install cmake -y
238 name: Install CMake (Retry)
240 command: choco install cmake -y
243 name: Install Mingw-w64
245 command: choco install mingw -y
247 name: Install Mingw-w64 (Retry)
249 command: choco install mingw -y
252 # Windows JDK Install
260 name: Download Older JDK
261 command: curl -o /c/users/circleci/jdk.zip <<parameters.jdk-url>>
264 name: Extract Older JDK
265 command: unzip /c/users/circleci/jdk.zip
266 - persist_to_workspace:
269 - <<pipeline.parameters.windows-jdk-base-dir>>/
271 # Install required packages on macOS
272 macos-install-required:
275 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
276 # we do not need that... also CMake as well for native code
277 name: Install Dependencies
278 command: brew install openjdk@11 coreutils cmake
280 name: Install Dependencies (Retry)
281 command: brew install openjdk@11 coreutils cmake
284 # Install what is required by Flatpak
285 flatpak-install-required:
287 - linux-debian-apt-get-install:
288 packages: flatpak flatpak-builder
290 name: Register Flathub
291 command: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
293 name: Flatpak FreeDesktop Platform
294 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//23.08
296 name: Flatpak FreeDesktop SDK
297 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Sdk//23.08
299 name: Flatpak OpenJDK
300 command: flatpak install --user -y --noninteractive flathub runtime/org.freedesktop.Sdk.Extension.openjdk11//23.08
302 # Flatpak Common Build Rules
303 flatpak-common-build:
309 name: Flatpak Build and Install
310 command: flatpak-builder --user --install --install-deps-from=flathub --allow-missing-runtimes --force-clean build-dir cc.squirreljme.SquirrelJME.yml
313 command: flatpak build-bundle $HOME/.local/share/flatpak/repo squirreljme-0.3.0-<<parameters.arch>>.flatpak cc.squirreljme.SquirrelJME
315 path: squirreljme-0.3.0-<<parameters.arch>>.flatpak
316 destination: squirreljme-0.3.0-<<parameters.arch>>.flatpak
318 # Common Build for Standalone (UNIX)
319 standalone-unix-common-build:
322 name: Construct Standalone
323 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
325 name: Construct Standalone (Retry)
326 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
329 name: Remove distracting JAR, if any
330 command: rm emulators/standalone/build/libs/standalone-*.jar
332 path: emulators/standalone/build/libs/
336 ################################## BUNDLE ##################################
338 executor: squirreljme-bundle
341 name: Delete working directory
342 command: rm -rf /home/circleci/work/co || echo "Ignoring..."
344 name: Setup working directory
345 command: mkdir -p /home/circleci/work/co || echo "Ignoring..."
347 name: Open repository
348 working_directory: /home/circleci/work/co
349 command: fossil open /home/repo/squirreljme.fossil --force
352 working_directory: /home/circleci/work/co
353 command: fossil checkout trunk || echo "Ignoring..."
355 name: Updating checkout
356 working_directory: /home/circleci/work/co
357 command: fossil update || echo "Ignoring..."
359 name: Ensure build is clean
360 working_directory: /home/circleci/work/co
361 command: ./gradlew clean --parallel
363 name: Run CI/CD Bundle Tasks
364 working_directory: /home/circleci/work/co
365 command: ./gradlew :tools:cicd-release-bundle:run --parallel
367 name: Run CI/CD Bundle Tasks (Retry)
368 working_directory: /home/circleci/work/co
369 command: ./gradlew :tools:cicd-release-bundle:run --parallel
372 name: Close repository
373 working_directory: /home/circleci/work/co
374 command: fossil close --force
377 ################################## WINDOWS #################################
378 build_windows_i386_setup:
384 - windows-install-jdk:
385 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
393 # Use older JDK for CircleCI
394 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
399 - windows-install-required
402 name: Gradle Build and Test
403 # According to documentation, Gradle on Windows has trouble and tries
404 # to make way too many workers which causes extreme resource.
405 # contention --max-workers=2
406 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
407 no_output_timeout: 60m
410 name: Gradle Build and Test (Retry)
411 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
412 no_output_timeout: 60m
416 where: "vm-test-hosted-debug"
421 home: "/c/users/circleci/"
422 store-home: "c:/users/circleci/"
424 where: "vm-test-hosted-release"
429 home: "/c/users/circleci/"
430 store-home: "c:/users/circleci/"
432 build_windows_i386_standalone:
438 # Use older JDK for CircleCI
439 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
444 - windows-install-required
447 name: Construct Standalone
448 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
450 name: Construct Standalone (Retry)
452 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
456 name: Remove distracting JAR, if any
457 command: rm emulators/standalone/build/libs/standalone-*.jar
459 path: emulators/standalone/build/libs/
462 build_windows_amd64_setup:
468 # Use older JDK for CircleCI
469 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
471 - windows-install-jdk:
472 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
480 # Use a reduced amount of memory to all the VMs so that it does not
481 # try grabbing all the memory that is available to the system.
484 # Use older JDK for CircleCI
485 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
490 - windows-install-required
492 name: Gradle Build and Test
494 # According to documentation, Gradle on Windows has trouble and tries
495 # to make way too many workers which causes extreme resource.
496 # contention --max-workers=2
497 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
498 no_output_timeout: 60m
500 name: Gradle Build and Test (Retry)
502 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
503 no_output_timeout: 60m
507 where: "vm-test-hosted-debug"
512 home: "/c/users/circleci/"
513 store-home: "c:/users/circleci/"
515 where: "vm-test-hosted-release"
520 home: "/c/users/circleci/"
521 store-home: "c:/users/circleci/"
523 build_windows_amd64_standalone:
529 # Use a reduced amount of memory to all the VMs so that it does not
530 # try grabbing all the memory that is available to the system.
533 # Use older JDK for CircleCI
534 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
539 - windows-install-required
541 name: Construct Standalone
543 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
545 name: Construct Standalone (Retry)
547 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
551 name: Remove distracting JAR, if any
552 command: rm emulators/standalone/build/libs/standalone-*.jar
554 path: emulators/standalone/build/libs/
557 ################################# MAC OS X #################################
559 executor: build-on-macos
563 name: Gradle Build and Test
564 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
565 no_output_timeout: 60m
567 name: Gradle Build and Test (Retry)
568 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
569 no_output_timeout: 60m
573 where: "vm-test-hosted-debug"
577 where: "vm-test-hosted-release"
581 executor: build-on-macos-m1
585 name: Gradle Build and Test
586 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
587 no_output_timeout: 60m
589 name: Gradle Build and Test (Retry)
590 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
591 no_output_timeout: 60m
595 where: "vm-test-hosted-debug"
599 where: "vm-test-hosted-release"
603 build_macosx_amd64_standalone:
604 executor: build-on-macos
609 - standalone-unix-common-build
610 build_macosx_aarch64_standalone:
611 executor: build-on-macos-m1
616 - standalone-unix-common-build
618 ################################### LINUX ##################################
621 executor: build-on-linux-amd64
624 - linux-install-required
626 name: Gradle Build and Test
627 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
628 no_output_timeout: 60m
630 name: Gradle Build and Test (Retry)
631 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
632 no_output_timeout: 60m
635 where: "vm-test-hosted-debug"
639 where: "vm-test-hosted-release"
643 build_linux_amd64_standalone:
644 executor: build-on-linux-amd64
647 - linux-install-required
650 - standalone-unix-common-build
651 build_linux_amd64_standalone_flatpak:
652 executor: build-on-linux-amd64
655 - linux-install-required
656 - flatpak-install-required
657 - flatpak-common-build:
662 executor: build-on-linux-arm64
665 - linux-install-required
667 name: Gradle Build and Test
668 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
669 no_output_timeout: 60m
671 name: Gradle Build and Test (Retry)
672 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
673 no_output_timeout: 60m
676 where: "vm-test-hosted-debug"
680 where: "vm-test-hosted-release"
684 build_linux_aarch64_standalone:
685 executor: build-on-linux-arm64
688 - linux-install-required
691 - standalone-unix-common-build
692 build_linux_aarch64_standalone_flatpak:
693 executor: build-on-linux-arm64
696 - linux-install-required
697 - flatpak-install-required
698 - flatpak-common-build:
701 # Linux RISC-V 64-bit
703 executor: build-on-linux-riscv64
707 name: Gradle Build and Test
708 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
709 no_output_timeout: 120m
711 name: Gradle Build and Test (Retry)
712 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
713 no_output_timeout: 120m
716 where: "vm-test-hosted-debug"
720 where: "vm-test-hosted-release"
724 build_linux_riscv64_standalone:
725 executor: build-on-linux-riscv64
730 - standalone-unix-common-build
732 ### OSS SonaType Nexus
734 executor: build-on-linux-amd64
737 - linux-install-required
741 name: Publish to OSS SonaType
742 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
745 test_springcoat_debug:
746 executor: build-on-linux-amd64
749 - linux-install-required
753 name: SpringCoat Tests
754 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
755 no_output_timeout: 60m
757 where: "vm-test-springcoat-debug"
760 test_springcoat_release:
761 executor: build-on-linux-amd64
764 - linux-install-required
768 name: SpringCoat Tests
769 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
770 no_output_timeout: 60m
772 where: "vm-test-springcoat-release"
776 ################################### USERS ##################################
778 executor: build-on-linux-amd64
781 - linux-install-required
784 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
787 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
789 name: Update Git User
791 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
795 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
798 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
802 cd "/tmp/wiki" && git push
804 ################################ CONSTRUCTION ###############################
805 # Runs the `testJar` task so any operations following this will run faster
806 # when they need to use these JARs
808 executor: build-on-linux-amd64
811 - linux-install-required
815 name: Construct Test JARs
816 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
823 ############################# STANDARD TESTS ############################
826 - test_springcoat_debug:
833 - test_springcoat_release:
840 - build_linux_amd64_standalone:
847 - build_linux_amd64_standalone_flatpak:
861 - build_linux_aarch64_standalone:
868 - build_linux_aarch64_standalone_flatpak:
877 # - build_linux_riscv64
878 # - build_linux_riscv64_standalone:
880 # - build_linux_riscv64
887 - build_windows_i386_setup:
892 - build_windows_i386:
894 - build_windows_i386_setup
899 - build_windows_i386_standalone:
908 - build_windows_amd64_setup
909 - build_windows_amd64:
911 - build_windows_amd64_setup
912 - build_windows_amd64_standalone:
914 - build_windows_amd64
920 # Mac OS X runs decently however the jobs for it have a higher cost, so
921 # only perform builds and tests for trunk to lower costs.
922 # Currently, I have an overabundance of credits...
925 - build_macosx_amd64_standalone:
932 - build_macosx_aarch64_standalone:
940 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
950 ###################### LIBRARY AND ROM CONSTRUCTION #####################
951 - construct_testJars:
959 ############################## DEPLOYMENT ##############################
962 - build_linux_amd64_standalone
963 - build_linux_amd64_standalone_flatpak
964 - build_linux_aarch64_standalone_flatpak
965 - build_windows_i386_standalone
966 - build_windows_amd64_standalone
967 - build_macosx_amd64_standalone
968 - build_macosx_aarch64_standalone
974 #################### TASKS TO INCREASE USER FRIENDLINESS ####################