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: Setup working directory
324 command: rm -rf co; mkdir -p co
326 name: Open repository
327 working_directory: co
328 command: fossil open /home/repo/squirreljme.fossil --force
331 working_directory: co
332 command: fossil checkout trunk || echo "Ignoring..."
334 name: Updating checkout
335 working_directory: co
336 command: fossil update || echo "Ignoring..."
338 name: Ensure build is clean
339 working_directory: co
340 comand: ./gradlew clean --parallel
342 name: Run CI/CD Bundle Tasks
343 working_directory: co
344 command: ./gradlew :tools:cicd-release-bundle:run --parallel
346 name: Close repository
347 working_directory: co
348 command: fossil close --force
351 ################################## WINDOWS #################################
352 build_windows_i386_setup:
358 - windows-install-jdk:
359 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
367 # Use older JDK for CircleCI
368 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
373 - windows-install-required
376 name: Gradle Build and Test
377 # According to documentation, Gradle on Windows has trouble and tries
378 # to make way too many workers which causes extreme resource.
379 # contention --max-workers=2
380 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
381 no_output_timeout: 60m
384 where: "vm-test-hosted-debug"
389 home: "/c/users/circleci/"
390 store-home: "c:/users/circleci/"
392 where: "vm-test-hosted-release"
397 home: "/c/users/circleci/"
398 store-home: "c:/users/circleci/"
400 build_windows_i386_standalone:
406 # Use older JDK for CircleCI
407 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
412 - windows-install-required
415 name: Construct Standalone
416 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
419 name: Remove distracting JAR, if any
420 command: rm emulators/standalone/build/libs/standalone-*.jar
422 path: emulators/standalone/build/libs/
425 build_windows_amd64_setup:
431 # Use older JDK for CircleCI
432 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
434 - windows-install-jdk:
435 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
443 # Use a reduced amount of memory to all the VMs so that it does not
444 # try grabbing all the memory that is available to the system.
447 # Use older JDK for CircleCI
448 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
453 - windows-install-required
456 name: Gradle Build and Test
457 # According to documentation, Gradle on Windows has trouble and tries
458 # to make way too many workers which causes extreme resource.
459 # contention --max-workers=2
460 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
461 no_output_timeout: 60m
464 where: "vm-test-hosted-debug"
469 home: "/c/users/circleci/"
470 store-home: "c:/users/circleci/"
472 where: "vm-test-hosted-release"
477 home: "/c/users/circleci/"
478 store-home: "c:/users/circleci/"
480 build_windows_amd64_standalone:
486 # Use a reduced amount of memory to all the VMs so that it does not
487 # try grabbing all the memory that is available to the system.
490 # Use older JDK for CircleCI
491 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
496 - windows-install-required
499 name: Construct Standalone
500 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
503 name: Remove distracting JAR, if any
504 command: rm emulators/standalone/build/libs/standalone-*.jar
506 path: emulators/standalone/build/libs/
509 ################################# MAC OS X #################################
511 executor: build-on-macos
515 name: Gradle Build and Test
516 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
517 no_output_timeout: 60m
520 where: "vm-test-hosted-debug"
524 where: "vm-test-hosted-release"
528 executor: build-on-macos-m1
532 name: Gradle Build and Test
533 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
534 no_output_timeout: 60m
537 where: "vm-test-hosted-debug"
541 where: "vm-test-hosted-release"
545 build_macosx_amd64_standalone:
546 executor: build-on-macos
551 - standalone-unix-common-build
552 build_macosx_arm64_standalone:
553 executor: build-on-macos-m1
558 - standalone-unix-common-build
560 ################################### LINUX ##################################
563 executor: build-on-linux-amd64
566 - linux-install-required
568 name: Gradle Build and Test
569 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
570 no_output_timeout: 60m
572 where: "vm-test-hosted-debug"
576 where: "vm-test-hosted-release"
580 build_linux_amd64_standalone:
581 executor: build-on-linux-amd64
584 - linux-install-required
587 - standalone-unix-common-build
588 build_linux_amd64_standalone_flatpak:
589 executor: build-on-linux-amd64
592 - linux-install-required
593 - flatpak-install-required
594 - flatpak-common-build:
599 executor: build-on-linux-arm64
602 - linux-install-required
604 name: Gradle Build and Test
605 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
606 no_output_timeout: 60m
608 where: "vm-test-hosted-debug"
612 where: "vm-test-hosted-release"
616 build_linux_arm64_standalone:
617 executor: build-on-linux-arm64
620 - linux-install-required
623 - standalone-unix-common-build
624 build_linux_arm64_standalone_flatpak:
625 executor: build-on-linux-arm64
628 - linux-install-required
629 - flatpak-install-required
630 - flatpak-common-build:
633 # Linux RISC-V 64-bit
635 executor: build-on-linux-riscv64
639 name: Gradle Build and Test
640 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
641 no_output_timeout: 120m
643 where: "vm-test-hosted-debug"
647 where: "vm-test-hosted-release"
651 build_linux_riscv64_standalone:
652 executor: build-on-linux-riscv64
657 - standalone-unix-common-build
659 ### OSS SonaType Nexus
661 executor: build-on-linux-amd64
664 - linux-install-required
668 name: Publish to OSS SonaType
669 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
672 test_springcoat_debug:
673 executor: build-on-linux-amd64
676 - linux-install-required
680 name: SpringCoat Tests
681 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
682 no_output_timeout: 60m
684 where: "vm-test-springcoat-debug"
687 test_springcoat_release:
688 executor: build-on-linux-amd64
691 - linux-install-required
695 name: SpringCoat Tests
696 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
697 no_output_timeout: 60m
699 where: "vm-test-springcoat-release"
703 ################################### USERS ##################################
705 executor: build-on-linux-amd64
708 - linux-install-required
711 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
714 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
716 name: Update Git User
718 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
722 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
725 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
729 cd "/tmp/wiki" && git push
731 ################################ CONSTRUCTION ###############################
732 # Runs the `testJar` task so any operations following this will run faster
733 # when they need to use these JARs
735 executor: build-on-linux-amd64
738 - linux-install-required
742 name: Construct Test JARs
743 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
750 ############################# STANDARD TESTS ############################
753 - test_springcoat_debug:
760 - test_springcoat_release:
767 - build_linux_amd64_standalone:
774 - build_linux_amd64_standalone_flatpak:
788 - build_linux_arm64_standalone:
795 - build_linux_arm64_standalone_flatpak:
804 # - build_linux_riscv64
805 # - build_linux_riscv64_standalone:
807 # - build_linux_riscv64
814 - build_windows_i386_setup:
819 - build_windows_i386:
821 - build_windows_i386_setup
826 - build_windows_i386_standalone:
835 - build_windows_amd64_setup
836 - build_windows_amd64:
838 - build_windows_amd64_setup
839 - build_windows_amd64_standalone:
841 - build_windows_amd64
847 # Mac OS X runs decently however the jobs for it have a higher cost, so
848 # only perform builds and tests for trunk to lower costs.
849 # Currently, I have an overabundance of credits...
852 - build_macosx_amd64_standalone:
859 - build_macosx_arm64_standalone:
867 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
877 ###################### LIBRARY AND ROM CONSTRUCTION #####################
878 - construct_testJars:
886 ############################## DEPLOYMENT ##############################
889 - build_linux_amd64_standalone
890 - build_linux_amd64_standalone_flatpak
891 - build_linux_arm64_standalone_flatpak
892 - build_windows_i386_standalone
893 - build_windows_amd64_standalone
894 - build_macosx_amd64_standalone
895 - build_macosx_arm64_standalone
901 #################### TASKS TO INCREASE USER FRIENDLINESS ####################