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
80 # Standard build for systems
81 standard-build-options:
83 default: build testHosted -x testSpringCoat -x testSpringCoatRelease -x testSpringCoatDebug -x javadoc -x javadocJar -x sourcesJar -x markdownJavaDoc
85 # Windows JDK versions
91 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-i586.zip
94 default: https://download.bell-sw.com/java/11.0.23+12/bellsoft-jdk11.0.23+12-windows-amd64.zip
96 # Commands that are used by almost everything
98 # Save Gradle cache and such so subsequent builds are faster
101 - persist_to_workspace:
110 # Saving of test results, since this is duplicated for many OSes
124 default: ./.no-persist/
130 default: ./.no-persist/
133 shell: <<parameters.shell>>
134 name: Save test results
136 mkdir -p "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/"
137 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/" \;
140 shell: <<parameters.shell>>
141 name: Save test results
143 mkdir -p "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/"
144 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/" \;
147 shell: <<parameters.shell>>
150 mkdir -p "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/"
151 <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/" \;
153 - store_test_results:
154 path: <<parameters.store-home>>/test-results
156 path: <<parameters.store-home>>/test-results
158 # Standard apt-get install
159 linux-debian-apt-get-install:
165 name: Install packages
167 DEBIAN_FRONTEND: noninteractive
169 NEEDRESTART_SUSPEND: 1
171 sudo apt-get install -y --no-install-recommends <<parameters.packages>>
173 # Standard apt-get install, optional
174 linux-debian-apt-get-install-optional:
182 name: Install packages (optional)
184 DEBIAN_FRONTEND: noninteractive
186 NEEDRESTART_SUSPEND: 1
188 if ! which "<<parameters.look>>"; then sudo apt-get install -y --no-install-recommends <<parameters.packages>> || echo "Failed, but ignoring..."; fi
190 # Install standard packages in Debian/Ubuntu
191 linux-install-required:
196 DEBIAN_FRONTEND: noninteractive
198 NEEDRESTART_SUSPEND: 1
199 command: apt-get update -y && apt-get -yqq install sudo || echo "Failed, but ignoring..."
201 name: Update package lists
203 DEBIAN_FRONTEND: noninteractive
205 NEEDRESTART_SUSPEND: 1
206 command: sudo apt-get update -y
207 - linux-debian-apt-get-install:
208 packages: cmake build-essential curl wget gcc g++ make clang git openssh-client
209 - linux-debian-apt-get-install-optional:
211 packages: openjdk-17-jdk
212 - linux-debian-apt-get-install-optional:
214 packages: openjdk-11-jdk
215 - linux-debian-apt-get-install-optional:
217 packages: openjdk-8-jdk
218 - linux-debian-apt-get-install-optional:
220 packages: openjdk-7-jdk
222 # Install required packages on Windows
223 windows-install-required:
228 command: choco install cmake -y
230 name: Install Mingw-w64
232 command: choco install mingw -y
234 # Windows JDK Install
242 name: Download Older JDK
243 command: curl -o /c/users/circleci/jdk.zip <<parameters.jdk-url>>
246 name: Extract Older JDK
247 command: unzip /c/users/circleci/jdk.zip
248 - persist_to_workspace:
251 - <<pipeline.parameters.windows-jdk-base-dir>>/
253 # Install required packages on macOS
254 macos-install-required:
257 # Only OpenJDK is required, Gradle always uses Gradle wrapper so
258 # we do not need that... also CMake as well for native code
259 name: Install Dependencies
260 command: brew install openjdk@11 coreutils cmake
262 # Install what is required by Flatpak
263 flatpak-install-required:
265 - linux-debian-apt-get-install:
266 packages: flatpak flatpak-builder
268 name: Register Flathub
269 command: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
271 name: Flatpak FreeDesktop Platform
272 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//23.08
274 name: Flatpak FreeDesktop SDK
275 command: flatpak install --user -y --noninteractive flathub org.freedesktop.Sdk//23.08
277 name: Flatpak OpenJDK
278 command: flatpak install --user -y --noninteractive flathub runtime/org.freedesktop.Sdk.Extension.openjdk11//23.08
280 # Flatpak Common Build Rules
281 flatpak-common-build:
287 name: Flatpak Build and Install
288 command: flatpak-builder --user --install --install-deps-from=flathub --allow-missing-runtimes --force-clean build-dir cc.squirreljme.SquirrelJME.yml
291 command: flatpak build-bundle $HOME/.local/share/flatpak/repo squirreljme-<<parameters.arch>>.flatpak cc.squirreljme.SquirrelJME
294 command: ls -al squirreljme-<<parameters.arch>>.flatpak
296 path: squirreljme-<<parameters.arch>>.flatpak
297 destination: squirreljme-<<parameters.arch>>.flatpak
299 # Common Build for Standalone (UNIX)
300 standalone-unix-common-build:
303 name: Construct Standalone
304 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
306 name: Remove distracting JAR, if any
307 command: rm emulators/standalone/build/libs/standalone-*.jar
309 path: emulators/standalone/build/libs/
313 ################################## BUNDLE ##################################
315 executor: build-on-linux-amd64
318 - linux-install-required
320 ################################## WINDOWS #################################
321 build_windows_i386_setup:
327 - windows-install-jdk:
328 jdk-url: <<pipeline.parameters.windows-jdk-i386>>
336 # Use older JDK for CircleCI
337 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
342 - windows-install-required
345 name: Gradle Build and Test
346 # According to documentation, Gradle on Windows has trouble and tries
347 # to make way too many workers which causes extreme resource.
348 # contention --max-workers=2
349 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
350 no_output_timeout: 60m
353 where: "vm-test-hosted-debug"
358 home: "/c/users/circleci/"
359 store-home: "c:/users/circleci/"
361 where: "vm-test-hosted-release"
366 home: "/c/users/circleci/"
367 store-home: "c:/users/circleci/"
369 build_windows_i386_standalone:
375 # Use older JDK for CircleCI
376 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
381 - windows-install-required
384 name: Construct Standalone
385 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
388 name: Remove distracting JAR, if any
389 command: rm emulators/standalone/build/libs/standalone-*.jar
391 path: emulators/standalone/build/libs/
394 build_windows_amd64_setup:
400 # Use older JDK for CircleCI
401 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
403 - windows-install-jdk:
404 jdk-url: <<pipeline.parameters.windows-jdk-amd64>>
412 # Use a reduced amount of memory to all the VMs so that it does not
413 # try grabbing all the memory that is available to the system.
416 # Use older JDK for CircleCI
417 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
422 - windows-install-required
425 name: Gradle Build and Test
426 # According to documentation, Gradle on Windows has trouble and tries
427 # to make way too many workers which causes extreme resource.
428 # contention --max-workers=2
429 command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
430 no_output_timeout: 60m
433 where: "vm-test-hosted-debug"
438 home: "/c/users/circleci/"
439 store-home: "c:/users/circleci/"
441 where: "vm-test-hosted-release"
446 home: "/c/users/circleci/"
447 store-home: "c:/users/circleci/"
449 build_windows_amd64_standalone:
455 # Use a reduced amount of memory to all the VMs so that it does not
456 # try grabbing all the memory that is available to the system.
459 # Use older JDK for CircleCI
460 JAVA_HOME: c:/users/circleci/project/<<pipeline.parameters.windows-jdk-base-dir>>/
465 - windows-install-required
468 name: Construct Standalone
469 command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
472 name: Remove distracting JAR, if any
473 command: rm emulators/standalone/build/libs/standalone-*.jar
475 path: emulators/standalone/build/libs/
478 ################################# MAC OS X #################################
480 executor: build-on-macos
484 name: Gradle Build and Test
485 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
486 no_output_timeout: 60m
489 where: "vm-test-hosted-debug"
493 where: "vm-test-hosted-release"
497 executor: build-on-macos-m1
501 name: Gradle Build and Test
502 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
503 no_output_timeout: 60m
506 where: "vm-test-hosted-debug"
510 where: "vm-test-hosted-release"
514 build_macosx_amd64_standalone:
515 executor: build-on-macos
520 - standalone-unix-common-build
521 build_macosx_arm64_standalone:
522 executor: build-on-macos-m1
527 - standalone-unix-common-build
529 ################################### LINUX ##################################
532 executor: build-on-linux-amd64
535 - linux-install-required
537 name: Gradle Build and Test
538 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
539 no_output_timeout: 60m
541 where: "vm-test-hosted-debug"
545 where: "vm-test-hosted-release"
549 build_linux_amd64_standalone:
550 executor: build-on-linux-amd64
553 - linux-install-required
556 - standalone-unix-common-build
557 build_linux_amd64_standalone_flatpak:
558 executor: build-on-linux-amd64
561 - linux-install-required
562 - flatpak-install-required
563 - flatpak-common-build:
568 executor: build-on-linux-arm64
571 - linux-install-required
573 name: Gradle Build and Test
574 command: timeout --foreground 60m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
575 no_output_timeout: 60m
577 where: "vm-test-hosted-debug"
581 where: "vm-test-hosted-release"
585 build_linux_arm64_standalone:
586 executor: build-on-linux-arm64
589 - linux-install-required
592 - standalone-unix-common-build
593 build_linux_arm64_standalone_flatpak:
594 executor: build-on-linux-arm64
597 - linux-install-required
598 - flatpak-install-required
599 - flatpak-common-build:
602 # Linux RISC-V 64-bit
604 executor: build-on-linux-riscv64
608 name: Gradle Build and Test
609 command: timeout --foreground 120m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
610 no_output_timeout: 120m
612 where: "vm-test-hosted-debug"
616 where: "vm-test-hosted-release"
620 build_linux_riscv64_standalone:
621 executor: build-on-linux-riscv64
626 - standalone-unix-common-build
628 ### OSS SonaType Nexus
630 executor: build-on-linux-amd64
633 - linux-install-required
637 name: Publish to OSS SonaType
638 command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
641 test_springcoat_debug:
642 executor: build-on-linux-amd64
645 - linux-install-required
649 name: SpringCoat Tests
650 command: timeout --foreground 60m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
651 no_output_timeout: 60m
653 where: "vm-test-springcoat-debug"
656 test_springcoat_release:
657 executor: build-on-linux-amd64
660 - linux-install-required
664 name: SpringCoat Tests
665 command: timeout --foreground 60m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
666 no_output_timeout: 60m
668 where: "vm-test-springcoat-release"
672 ################################### USERS ##################################
674 executor: build-on-linux-amd64
677 - linux-install-required
680 command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
683 command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
685 name: Update Git User
687 cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
691 cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
694 - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
698 cd "/tmp/wiki" && git push
700 ################################ CONSTRUCTION ###############################
701 # Runs the `testJar` task so any operations following this will run faster
702 # when they need to use these JARs
704 executor: build-on-linux-amd64
707 - linux-install-required
711 name: Construct Test JARs
712 command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
719 ############################# STANDARD TESTS ############################
722 - test_springcoat_debug:
725 - test_springcoat_release:
732 - build_linux_amd64_standalone:
739 - build_linux_amd64_standalone_flatpak:
749 - build_linux_arm64_standalone:
756 - build_linux_arm64_standalone_flatpak:
765 # - build_linux_riscv64
766 # - build_linux_riscv64_standalone:
768 # - build_linux_riscv64
775 - build_windows_i386_setup
776 - build_windows_i386:
778 - build_windows_i386_setup
779 - build_windows_i386_standalone:
788 - build_windows_amd64_setup
789 - build_windows_amd64:
791 - build_windows_amd64_setup
792 - build_windows_amd64_standalone:
794 - build_windows_amd64
800 # Mac OS X runs decently however the jobs for it have a higher cost, so
801 # only perform builds and tests for trunk to lower costs.
802 # Currently, I have an overabundance of credits...
805 - build_macosx_amd64_standalone:
812 - build_macosx_arm64_standalone:
820 # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
830 ###################### LIBRARY AND ROM CONSTRUCTION #####################
831 - construct_testJars:
835 ############################## DEPLOYMENT ##############################
838 - build_linux_amd64_standalone
839 - build_windows_amd64_standalone
840 - build_macosx_amd64_standalone
841 - build_macosx_arm64_standalone
847 #################### TASKS TO INCREASE USER FRIENDLINESS ####################