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
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
82 default: -x testSpringCoat -x testSpringCoatRelease -x testSpringCoatDebug -x javadoc -x javadocJar -x sourcesJar -x markdownJavaDoc
84 # Standard build for systems
85 standard-build-options:
87 default: build testHosted <<pipeline.parameters.standard-exclusion>>
89 # Windows JDK versions
95 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-i586.zip
98 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-amd64.zip
100 # Commands that are used by almost everything
102 # Save Gradle cache and such so subsequent builds are faster
105 - persist_to_workspace:
114 # Saving of test results, since this is duplicated for many OSes
128 default: ./.no-persist/
134 default: ./.no-persist/
137 shell: <<parameters.shell>>
138 name: Save test results
140 mkdir -p "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/"
141 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/" \;
144 shell: <<parameters.shell>>
145 name: Save test results
147 mkdir -p "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/"
148 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/" \;
151 shell: <<parameters.shell>>
154 mkdir -p "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/"
155 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/" \;
157 - store_test_results:
158 path: <<parameters.store-home>>/test-results
160 path: <<parameters.store-home>>/test-results
162 # Standard apt-get install
163 linux-debian-apt-get-install:
169 name: Install packages
171 DEBIAN_FRONTEND: noninteractive
173 NEEDRESTART_SUSPEND: 1
175 sudo apt-get install -y --no-install-recommends <<parameters.packages>>
177 # Standard apt-get install, optional
178 linux-debian-apt-get-install-optional:
186 name: Install packages (optional)
188 DEBIAN_FRONTEND: noninteractive
190 NEEDRESTART_SUSPEND: 1
192 if ! which "<<parameters.look>>"; then sudo apt-get install -y --no-install-recommends <<parameters.packages>> || echo "Failed, but ignoring..."; fi
194 # Install standard packages in Debian/Ubuntu
195 linux-install-required:
200 DEBIAN_FRONTEND: noninteractive
202 NEEDRESTART_SUSPEND: 1
203 command: apt-get update -y && apt-get -yqq install sudo || echo "Failed, but ignoring..."
205 name: Update package lists
207 DEBIAN_FRONTEND: noninteractive
209 NEEDRESTART_SUSPEND: 1
210 command: sudo apt-get update -y
211 - linux-debian-apt-get-install:
212 packages: cmake build-essential curl wget gcc g++ make clang git openssh-client
213 - linux-debian-apt-get-install-optional:
215 packages: openjdk-17-jdk
216 - linux-debian-apt-get-install-optional:
218 packages: openjdk-11-jdk
219 - linux-debian-apt-get-install-optional:
221 packages: openjdk-8-jdk
222 - linux-debian-apt-get-install-optional:
224 packages: openjdk-7-jdk
226 # Install required packages on Windows
227 windows-install-required:
232 command: choco install cmake -y
234 name: Install Mingw-w64
236 command: choco install mingw -y
238 # Windows JDK Install
246 name: Download Older JDK
247 command: curl -o /c/users/circleci/jdk.zip <<parameters.jdk-url>>
250 name: Extract Older JDK
251 command: unzip /c/users/circleci/jdk.zip
252 - persist_to_workspace:
255 - <<pipeline.parameters.windows-jdk-base-dir>>/
257 # Install required packages on macOS
258 macos-install-required:
261 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
262 # we do not need that... also CMake as well for native code
263 name: Install Dependencies
264 command: brew install openjdk@11 coreutils cmake
266 # Install what is required by Flatpak
267 flatpak-install-required:
269 - linux-debian-apt-get-install:
270 packages: flatpak flatpak-builder
272 name: Register Flathub
273 command: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
275 name: Flatpak FreeDesktop Platform
276 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//23.08
278 name: Flatpak FreeDesktop SDK
279 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Sdk//23.08
281 name: Flatpak OpenJDK
282 command: flatpak install --user -y --noninteractive flathub runtime/org.freedesktop.Sdk.Extension.openjdk11//23.08
284 # Flatpak Common Build Rules
285 flatpak-common-build:
291 name: Flatpak Build and Install
292 command: flatpak-builder --user --install --install-deps-from=flathub --allow-missing-runtimes --force-clean build-dir cc.squirreljme.SquirrelJME.yml
295 command: flatpak build-bundle $HOME/.local/share/flatpak/repo squirreljme-<<parameters.arch>>.flatpak cc.squirreljme.SquirrelJME
298 command: ls -al squirreljme-<<parameters.arch>>.flatpak
300 path: squirreljme-<<parameters.arch>>.flatpak
301 destination: squirreljme-<<parameters.arch>>.flatpak
303 # Common Build for Standalone (UNIX)
304 standalone-unix-common-build:
307 name: Construct Standalone
308 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
310 name: Remove distracting JAR, if any
311 command: rm emulators/standalone/build/libs/standalone-*.jar
313 path: emulators/standalone/build/libs/
317 ################################## BUNDLE ##################################
319 executor: build-on-linux-amd64
322 - linux-install-required
324 name: Build NanoCoat squirreljme.jar
325 command: ./gradlew :romNanoCoatRelease <<pipeline.parameters.standard-gradle-options>> <<pipeline.parameters.standard-exclusion>>
327 path: build/squirreljme/vm-main-nanocoat-release/squirreljme.jar
330 ################################## WINDOWS #################################
331 build_windows_i386_setup:
337 - windows-install-jdk:
338 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
346 # Use older JDK for CircleCI
347 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
352 - windows-install-required
355 name: Gradle Build and Test
356 # According to documentation, Gradle on Windows has trouble and tries
357 # to make way too many workers which causes extreme resource.
358 # contention --max-workers=2
359 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
360 no_output_timeout: 60m
363 where: "vm-test-hosted-debug"
368 home: "/c/users/circleci/"
369 store-home: "c:/users/circleci/"
371 where: "vm-test-hosted-release"
376 home: "/c/users/circleci/"
377 store-home: "c:/users/circleci/"
379 build_windows_i386_standalone:
385 # Use older JDK for CircleCI
386 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
391 - windows-install-required
394 name: Construct Standalone
395 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
398 name: Remove distracting JAR, if any
399 command: rm emulators/standalone/build/libs/standalone-*.jar
401 path: emulators/standalone/build/libs/
404 build_windows_amd64_setup:
410 # Use older JDK for CircleCI
411 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
413 - windows-install-jdk:
414 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
422 # Use a reduced amount of memory to all the VMs so that it does not
423 # try grabbing all the memory that is available to the system.
426 # Use older JDK for CircleCI
427 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
432 - windows-install-required
435 name: Gradle Build and Test
436 # According to documentation, Gradle on Windows has trouble and tries
437 # to make way too many workers which causes extreme resource.
438 # contention --max-workers=2
439 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
440 no_output_timeout: 60m
443 where: "vm-test-hosted-debug"
448 home: "/c/users/circleci/"
449 store-home: "c:/users/circleci/"
451 where: "vm-test-hosted-release"
456 home: "/c/users/circleci/"
457 store-home: "c:/users/circleci/"
459 build_windows_amd64_standalone:
465 # Use a reduced amount of memory to all the VMs so that it does not
466 # try grabbing all the memory that is available to the system.
469 # Use older JDK for CircleCI
470 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
475 - windows-install-required
478 name: Construct Standalone
479 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
482 name: Remove distracting JAR, if any
483 command: rm emulators/standalone/build/libs/standalone-*.jar
485 path: emulators/standalone/build/libs/
488 ################################# MAC OS X #################################
490 executor: build-on-macos
494 name: Gradle Build and Test
495 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
496 no_output_timeout: 60m
499 where: "vm-test-hosted-debug"
503 where: "vm-test-hosted-release"
507 executor: build-on-macos-m1
511 name: Gradle Build and Test
512 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
513 no_output_timeout: 60m
516 where: "vm-test-hosted-debug"
520 where: "vm-test-hosted-release"
524 build_macosx_amd64_standalone:
525 executor: build-on-macos
530 - standalone-unix-common-build
531 build_macosx_arm64_standalone:
532 executor: build-on-macos-m1
537 - standalone-unix-common-build
539 ################################### LINUX ##################################
542 executor: build-on-linux-amd64
545 - linux-install-required
547 name: Gradle Build and Test
548 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
549 no_output_timeout: 60m
551 where: "vm-test-hosted-debug"
555 where: "vm-test-hosted-release"
559 build_linux_amd64_standalone:
560 executor: build-on-linux-amd64
563 - linux-install-required
566 - standalone-unix-common-build
567 build_linux_amd64_standalone_flatpak:
568 executor: build-on-linux-amd64
571 - linux-install-required
572 - flatpak-install-required
573 - flatpak-common-build:
578 executor: build-on-linux-arm64
581 - linux-install-required
583 name: Gradle Build and Test
584 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
585 no_output_timeout: 60m
587 where: "vm-test-hosted-debug"
591 where: "vm-test-hosted-release"
595 build_linux_arm64_standalone:
596 executor: build-on-linux-arm64
599 - linux-install-required
602 - standalone-unix-common-build
603 build_linux_arm64_standalone_flatpak:
604 executor: build-on-linux-arm64
607 - linux-install-required
608 - flatpak-install-required
609 - flatpak-common-build:
612 # Linux RISC-V 64-bit
614 executor: build-on-linux-riscv64
618 name: Gradle Build and Test
619 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-exclusion>> <<pipeline.parameters.standard-gradle-options>>
620 no_output_timeout: 120m
622 where: "vm-test-hosted-debug"
626 where: "vm-test-hosted-release"
630 build_linux_riscv64_standalone:
631 executor: build-on-linux-riscv64
636 - standalone-unix-common-build
638 ### OSS SonaType Nexus
640 executor: build-on-linux-amd64
643 - linux-install-required
647 name: Publish to OSS SonaType
648 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
651 test_springcoat_debug:
652 executor: build-on-linux-amd64
655 - linux-install-required
659 name: SpringCoat Tests
660 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
661 no_output_timeout: 60m
663 where: "vm-test-springcoat-debug"
666 test_springcoat_release:
667 executor: build-on-linux-amd64
670 - linux-install-required
674 name: SpringCoat Tests
675 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
676 no_output_timeout: 60m
678 where: "vm-test-springcoat-release"
682 ################################### USERS ##################################
684 executor: build-on-linux-amd64
687 - linux-install-required
690 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
693 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
695 name: Update Git User
697 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
701 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
704 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
708 cd "/tmp/wiki" && git push
710 ################################ CONSTRUCTION ###############################
711 # Runs the `testJar` task so any operations following this will run faster
712 # when they need to use these JARs
714 executor: build-on-linux-amd64
717 - linux-install-required
721 name: Construct Test JARs
722 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
729 ############################# STANDARD TESTS ############################
732 - test_springcoat_debug:
739 - test_springcoat_release:
746 - build_linux_amd64_standalone:
753 - build_linux_amd64_standalone_flatpak:
767 - build_linux_arm64_standalone:
774 - build_linux_arm64_standalone_flatpak:
783 # - build_linux_riscv64
784 # - build_linux_riscv64_standalone:
786 # - build_linux_riscv64
793 - build_windows_i386_setup:
798 - build_windows_i386:
800 - build_windows_i386_setup
805 - build_windows_i386_standalone:
814 - build_windows_amd64_setup
815 - build_windows_amd64:
817 - build_windows_amd64_setup
818 - build_windows_amd64_standalone:
820 - build_windows_amd64
826 # Mac OS X runs decently however the jobs for it have a higher cost, so
827 # only perform builds and tests for trunk to lower costs.
828 # Currently, I have an overabundance of credits...
831 - build_macosx_amd64_standalone:
838 - build_macosx_arm64_standalone:
846 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
856 ###################### LIBRARY AND ROM CONSTRUCTION #####################
857 - construct_testJars:
865 ############################## DEPLOYMENT ##############################
868 - build_linux_amd64_standalone
869 - build_windows_amd64_standalone
870 - build_macosx_amd64_standalone
871 - build_macosx_arm64_standalone
877 #################### TASKS TO INCREASE USER FRIENDLINESS ####################