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 Mingw-w64
240 command: choco install mingw -y
242 # Windows JDK Install
250 name: Download Older JDK
251 command: curl -o /c/users/circleci/jdk.zip <<parameters.jdk-url>>
254 name: Extract Older JDK
255 command: unzip /c/users/circleci/jdk.zip
256 - persist_to_workspace:
259 - <<pipeline.parameters.windows-jdk-base-dir>>/
261 # Install required packages on macOS
262 macos-install-required:
265 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
266 # we do not need that... also CMake as well for native code
267 name: Install Dependencies
268 command: brew install openjdk@11 coreutils cmake
270 # Install what is required by Flatpak
271 flatpak-install-required:
273 - linux-debian-apt-get-install:
274 packages: flatpak flatpak-builder
276 name: Register Flathub
277 command: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
279 name: Flatpak FreeDesktop Platform
280 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//23.08
282 name: Flatpak FreeDesktop SDK
283 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Sdk//23.08
285 name: Flatpak OpenJDK
286 command: flatpak install --user -y --noninteractive flathub runtime/org.freedesktop.Sdk.Extension.openjdk11//23.08
288 # Flatpak Common Build Rules
289 flatpak-common-build:
295 name: Flatpak Build and Install
296 command: flatpak-builder --user --install --install-deps-from=flathub --allow-missing-runtimes --force-clean build-dir cc.squirreljme.SquirrelJME.yml
299 command: flatpak build-bundle $HOME/.local/share/flatpak/repo squirreljme-0.3.0-<<parameters.arch>>.flatpak cc.squirreljme.SquirrelJME
301 path: squirreljme-0.3.0-<<parameters.arch>>.flatpak
302 destination: squirreljme-0.3.0-<<parameters.arch>>.flatpak
304 # Common Build for Standalone (UNIX)
305 standalone-unix-common-build:
308 name: Construct Standalone
309 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/
318 ################################## BUNDLE ##################################
320 executor: squirreljme-bundle
323 name: Delete working directory
324 command: rm -rf /home/circleci/work/co || echo "Ignoring..."
326 name: Setup working directory
327 command: mkdir -p /home/circleci/work/co || echo "Ignoring..."
329 name: Open repository
330 working_directory: /home/circleci/work/co
331 command: fossil open /home/repo/squirreljme.fossil --force
334 working_directory: /home/circleci/work/co
335 command: fossil checkout trunk || echo "Ignoring..."
337 name: Updating checkout
338 working_directory: /home/circleci/work/co
339 command: fossil update || echo "Ignoring..."
341 name: Ensure build is clean
342 working_directory: /home/circleci/work/co
343 command: ./gradlew clean --parallel
345 name: Run CI/CD Bundle Tasks
346 working_directory: /home/circleci/work/co
347 command: ./gradlew :tools:cicd-release-bundle:run --parallel
349 name: Close repository
350 working_directory: /home/circleci/work/co
351 command: fossil close --force
354 ################################## WINDOWS #################################
355 build_windows_i386_setup:
361 - windows-install-jdk:
362 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
370 # Use older JDK for CircleCI
371 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
376 - windows-install-required
379 name: Gradle Build and Test
380 # According to documentation, Gradle on Windows has trouble and tries
381 # to make way too many workers which causes extreme resource.
382 # contention --max-workers=2
383 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
384 no_output_timeout: 60m
387 where: "vm-test-hosted-debug"
392 home: "/c/users/circleci/"
393 store-home: "c:/users/circleci/"
395 where: "vm-test-hosted-release"
400 home: "/c/users/circleci/"
401 store-home: "c:/users/circleci/"
403 build_windows_i386_standalone:
409 # Use older JDK for CircleCI
410 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
415 - windows-install-required
418 name: Construct Standalone
419 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
422 name: Remove distracting JAR, if any
423 command: rm emulators/standalone/build/libs/standalone-*.jar
425 path: emulators/standalone/build/libs/
428 build_windows_amd64_setup:
434 # Use older JDK for CircleCI
435 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
437 - windows-install-jdk:
438 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
446 # Use a reduced amount of memory to all the VMs so that it does not
447 # try grabbing all the memory that is available to the system.
450 # Use older JDK for CircleCI
451 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
456 - windows-install-required
459 name: Gradle Build and Test
460 # According to documentation, Gradle on Windows has trouble and tries
461 # to make way too many workers which causes extreme resource.
462 # contention --max-workers=2
463 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
464 no_output_timeout: 60m
467 where: "vm-test-hosted-debug"
472 home: "/c/users/circleci/"
473 store-home: "c:/users/circleci/"
475 where: "vm-test-hosted-release"
480 home: "/c/users/circleci/"
481 store-home: "c:/users/circleci/"
483 build_windows_amd64_standalone:
489 # Use a reduced amount of memory to all the VMs so that it does not
490 # try grabbing all the memory that is available to the system.
493 # Use older JDK for CircleCI
494 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
499 - windows-install-required
502 name: Construct Standalone
503 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
506 name: Remove distracting JAR, if any
507 command: rm emulators/standalone/build/libs/standalone-*.jar
509 path: emulators/standalone/build/libs/
512 ################################# MAC OS X #################################
514 executor: build-on-macos
518 name: Gradle Build and Test
519 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
520 no_output_timeout: 60m
523 where: "vm-test-hosted-debug"
527 where: "vm-test-hosted-release"
531 executor: build-on-macos-m1
535 name: Gradle Build and Test
536 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
537 no_output_timeout: 60m
540 where: "vm-test-hosted-debug"
544 where: "vm-test-hosted-release"
548 build_macosx_amd64_standalone:
549 executor: build-on-macos
554 - standalone-unix-common-build
555 build_macosx_arm64_standalone:
556 executor: build-on-macos-m1
561 - standalone-unix-common-build
563 ################################### LINUX ##################################
566 executor: build-on-linux-amd64
569 - linux-install-required
571 name: Gradle Build and Test
572 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
573 no_output_timeout: 60m
575 where: "vm-test-hosted-debug"
579 where: "vm-test-hosted-release"
583 build_linux_amd64_standalone:
584 executor: build-on-linux-amd64
587 - linux-install-required
590 - standalone-unix-common-build
591 build_linux_amd64_standalone_flatpak:
592 executor: build-on-linux-amd64
595 - linux-install-required
596 - flatpak-install-required
597 - flatpak-common-build:
602 executor: build-on-linux-arm64
605 - linux-install-required
607 name: Gradle Build and Test
608 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
609 no_output_timeout: 60m
611 where: "vm-test-hosted-debug"
615 where: "vm-test-hosted-release"
619 build_linux_arm64_standalone:
620 executor: build-on-linux-arm64
623 - linux-install-required
626 - standalone-unix-common-build
627 build_linux_arm64_standalone_flatpak:
628 executor: build-on-linux-arm64
631 - linux-install-required
632 - flatpak-install-required
633 - flatpak-common-build:
636 # Linux RISC-V 64-bit
638 executor: build-on-linux-riscv64
642 name: Gradle Build and Test
643 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
644 no_output_timeout: 120m
646 where: "vm-test-hosted-debug"
650 where: "vm-test-hosted-release"
654 build_linux_riscv64_standalone:
655 executor: build-on-linux-riscv64
660 - standalone-unix-common-build
662 ### OSS SonaType Nexus
664 executor: build-on-linux-amd64
667 - linux-install-required
671 name: Publish to OSS SonaType
672 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
675 test_springcoat_debug:
676 executor: build-on-linux-amd64
679 - linux-install-required
683 name: SpringCoat Tests
684 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
685 no_output_timeout: 60m
687 where: "vm-test-springcoat-debug"
690 test_springcoat_release:
691 executor: build-on-linux-amd64
694 - linux-install-required
698 name: SpringCoat Tests
699 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
700 no_output_timeout: 60m
702 where: "vm-test-springcoat-release"
706 ################################### USERS ##################################
708 executor: build-on-linux-amd64
711 - linux-install-required
714 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
717 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
719 name: Update Git User
721 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
725 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
728 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
732 cd "/tmp/wiki" && git push
734 ################################ CONSTRUCTION ###############################
735 # Runs the `testJar` task so any operations following this will run faster
736 # when they need to use these JARs
738 executor: build-on-linux-amd64
741 - linux-install-required
745 name: Construct Test JARs
746 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
753 ############################# STANDARD TESTS ############################
756 - test_springcoat_debug:
763 - test_springcoat_release:
770 - build_linux_amd64_standalone:
777 - build_linux_amd64_standalone_flatpak:
791 - build_linux_arm64_standalone:
798 - build_linux_arm64_standalone_flatpak:
807 # - build_linux_riscv64
808 # - build_linux_riscv64_standalone:
810 # - build_linux_riscv64
817 - build_windows_i386_setup:
822 - build_windows_i386:
824 - build_windows_i386_setup
829 - build_windows_i386_standalone:
838 - build_windows_amd64_setup
839 - build_windows_amd64:
841 - build_windows_amd64_setup
842 - build_windows_amd64_standalone:
844 - build_windows_amd64
850 # Mac OS X runs decently however the jobs for it have a higher cost, so
851 # only perform builds and tests for trunk to lower costs.
852 # Currently, I have an overabundance of credits...
855 - build_macosx_amd64_standalone:
862 - build_macosx_arm64_standalone:
870 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
880 ###################### LIBRARY AND ROM CONSTRUCTION #####################
881 - construct_testJars:
889 ############################## DEPLOYMENT ##############################
892 - build_linux_amd64_standalone
893 - build_linux_amd64_standalone_flatpak
894 - build_linux_arm64_standalone_flatpak
895 - build_windows_i386_standalone
896 - build_windows_amd64_standalone
897 - build_macosx_amd64_standalone
898 - build_macosx_arm64_standalone
904 #################### TASKS TO INCREASE USER FRIENDLINESS ####################