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: Open repository
324 command: fossil open /home/repo/squirreljme.fossil --force
326 name: Run CI/CD Bundle Tasks
327 command: ./gradlew clean :tools:cicd-release-bundle:run
329 name: Close repository
330 command: fossil close --force
333 ################################## WINDOWS #################################
334 build_windows_i386_setup:
340 - windows-install-jdk:
341 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
349 # Use older JDK for CircleCI
350 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
355 - windows-install-required
358 name: Gradle Build and Test
359 # According to documentation, Gradle on Windows has trouble and tries
360 # to make way too many workers which causes extreme resource.
361 # contention --max-workers=2
362 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
363 no_output_timeout: 60m
366 where: "vm-test-hosted-debug"
371 home: "/c/users/circleci/"
372 store-home: "c:/users/circleci/"
374 where: "vm-test-hosted-release"
379 home: "/c/users/circleci/"
380 store-home: "c:/users/circleci/"
382 build_windows_i386_standalone:
388 # Use older JDK for CircleCI
389 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
394 - windows-install-required
397 name: Construct Standalone
398 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
401 name: Remove distracting JAR, if any
402 command: rm emulators/standalone/build/libs/standalone-*.jar
404 path: emulators/standalone/build/libs/
407 build_windows_amd64_setup:
413 # Use older JDK for CircleCI
414 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
416 - windows-install-jdk:
417 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
425 # Use a reduced amount of memory to all the VMs so that it does not
426 # try grabbing all the memory that is available to the system.
429 # Use older JDK for CircleCI
430 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
435 - windows-install-required
438 name: Gradle Build and Test
439 # According to documentation, Gradle on Windows has trouble and tries
440 # to make way too many workers which causes extreme resource.
441 # contention --max-workers=2
442 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
443 no_output_timeout: 60m
446 where: "vm-test-hosted-debug"
451 home: "/c/users/circleci/"
452 store-home: "c:/users/circleci/"
454 where: "vm-test-hosted-release"
459 home: "/c/users/circleci/"
460 store-home: "c:/users/circleci/"
462 build_windows_amd64_standalone:
468 # Use a reduced amount of memory to all the VMs so that it does not
469 # try grabbing all the memory that is available to the system.
472 # Use older JDK for CircleCI
473 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
478 - windows-install-required
481 name: Construct Standalone
482 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
485 name: Remove distracting JAR, if any
486 command: rm emulators/standalone/build/libs/standalone-*.jar
488 path: emulators/standalone/build/libs/
491 ################################# MAC OS X #################################
493 executor: build-on-macos
497 name: Gradle Build and Test
498 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
499 no_output_timeout: 60m
502 where: "vm-test-hosted-debug"
506 where: "vm-test-hosted-release"
510 executor: build-on-macos-m1
514 name: Gradle Build and Test
515 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
516 no_output_timeout: 60m
519 where: "vm-test-hosted-debug"
523 where: "vm-test-hosted-release"
527 build_macosx_amd64_standalone:
528 executor: build-on-macos
533 - standalone-unix-common-build
534 build_macosx_arm64_standalone:
535 executor: build-on-macos-m1
540 - standalone-unix-common-build
542 ################################### LINUX ##################################
545 executor: build-on-linux-amd64
548 - linux-install-required
550 name: Gradle Build and Test
551 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
552 no_output_timeout: 60m
554 where: "vm-test-hosted-debug"
558 where: "vm-test-hosted-release"
562 build_linux_amd64_standalone:
563 executor: build-on-linux-amd64
566 - linux-install-required
569 - standalone-unix-common-build
570 build_linux_amd64_standalone_flatpak:
571 executor: build-on-linux-amd64
574 - linux-install-required
575 - flatpak-install-required
576 - flatpak-common-build:
581 executor: build-on-linux-arm64
584 - linux-install-required
586 name: Gradle Build and Test
587 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
588 no_output_timeout: 60m
590 where: "vm-test-hosted-debug"
594 where: "vm-test-hosted-release"
598 build_linux_arm64_standalone:
599 executor: build-on-linux-arm64
602 - linux-install-required
605 - standalone-unix-common-build
606 build_linux_arm64_standalone_flatpak:
607 executor: build-on-linux-arm64
610 - linux-install-required
611 - flatpak-install-required
612 - flatpak-common-build:
615 # Linux RISC-V 64-bit
617 executor: build-on-linux-riscv64
621 name: Gradle Build and Test
622 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
623 no_output_timeout: 120m
625 where: "vm-test-hosted-debug"
629 where: "vm-test-hosted-release"
633 build_linux_riscv64_standalone:
634 executor: build-on-linux-riscv64
639 - standalone-unix-common-build
641 ### OSS SonaType Nexus
643 executor: build-on-linux-amd64
646 - linux-install-required
650 name: Publish to OSS SonaType
651 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
654 test_springcoat_debug:
655 executor: build-on-linux-amd64
658 - linux-install-required
662 name: SpringCoat Tests
663 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
664 no_output_timeout: 60m
666 where: "vm-test-springcoat-debug"
669 test_springcoat_release:
670 executor: build-on-linux-amd64
673 - linux-install-required
677 name: SpringCoat Tests
678 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
679 no_output_timeout: 60m
681 where: "vm-test-springcoat-release"
685 ################################### USERS ##################################
687 executor: build-on-linux-amd64
690 - linux-install-required
693 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
696 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
698 name: Update Git User
700 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
704 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
707 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
711 cd "/tmp/wiki" && git push
713 ################################ CONSTRUCTION ###############################
714 # Runs the `testJar` task so any operations following this will run faster
715 # when they need to use these JARs
717 executor: build-on-linux-amd64
720 - linux-install-required
724 name: Construct Test JARs
725 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
732 ############################# STANDARD TESTS ############################
735 - test_springcoat_debug:
742 - test_springcoat_release:
749 - build_linux_amd64_standalone:
756 - build_linux_amd64_standalone_flatpak:
770 - build_linux_arm64_standalone:
777 - build_linux_arm64_standalone_flatpak:
786 # - build_linux_riscv64
787 # - build_linux_riscv64_standalone:
789 # - build_linux_riscv64
796 - build_windows_i386_setup:
801 - build_windows_i386:
803 - build_windows_i386_setup
808 - build_windows_i386_standalone:
817 - build_windows_amd64_setup
818 - build_windows_amd64:
820 - build_windows_amd64_setup
821 - build_windows_amd64_standalone:
823 - build_windows_amd64
829 # Mac OS X runs decently however the jobs for it have a higher cost, so
830 # only perform builds and tests for trunk to lower costs.
831 # Currently, I have an overabundance of credits...
834 - build_macosx_amd64_standalone:
841 - build_macosx_arm64_standalone:
849 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
859 ###################### LIBRARY AND ROM CONSTRUCTION #####################
860 - construct_testJars:
868 ############################## DEPLOYMENT ##############################
871 - build_linux_amd64_standalone
872 - build_linux_amd64_standalone_flatpak
873 - build_linux_arm64_standalone_flatpak
874 - build_windows_i386_standalone
875 - build_windows_amd64_standalone
876 - build_macosx_amd64_standalone
877 - build_macosx_arm64_standalone
883 #################### TASKS TO INCREASE USER FRIENDLINESS ####################