Add second Lex SVG image by Kat Adam-MacEwen.
[SquirrelJME.git] / .circleci / config.yml
blob93b455b14e9bd4ef470080240e2cb6b886fa285b
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/
14 version: 2.1
16 executors:
17   build-on-linux-amd64:
18     docker:
19       - image: cimg/openjdk:11.0
20     resource_class: medium
21     environment:
22       # Allow Gradle to be fully cached
23       GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
24   build-on-linux-arm64:
25     docker:
26       - image: cimg/ubuntu-2004:current
27     resource_class: arm.medium
28     environment:
29       # Allow Gradle to be fully cached
30       GRADLE_USER_HOME: ${CIRCLE_WORKING_DIRECTORY}/.gradle/home
32 # This is in the documentation but does not actually work, new feature?
33 #  build-on-windows:
34 #    windows:
35 #      name: win/default
36 #      shell: cmd.exe
37 #    resource_class: medium
38 #    environment:
39 #      # Use a reduced amount of memory to all the VMs so that it does not
40 #      # try grabbing all the memory that is available to the system.
41 #      JAVA_OPTS: -Xmx3g
43   build-on-macos:
44     macos:
45       xcode: 13.2.1
46     resource_class: macos.x86.medium.gen2
47     environment:
48       # Do not auto-update brew as this takes forever, and we really just want
49       # a single package
50       HOMEBREW_NO_AUTO_UPDATE: 1
52       # Do not auto-clean brew, this wastes time and everything will be thrown
53       # out when the container finishes anyway
54       HOMEBREW_CLEANUP_MAX_AGE_DAYS: 730
56       # Do not send analytics
57       HOMEBREW_NO_ANALYTICS: 1
59       # Do not clean up after installation
60       HOMEBREW_NO_INSTALL_CLEANUP: 1
62   build-on-macos-m1:
63     machine: true
64     resource_class: squirreljme/squirreljme-macos-m1
66 orbs:
67   win: circleci/windows@2.4.0
69 # Parameters to simplify commands
70 parameters:
71   # Options to be used for any Gradle command, is faster this way
72   standard-gradle-options:
73     type: string
74     default: --console plain --continue --parallel --no-daemon --stacktrace
76   # Standard build for systems
77   standard-build-options:
78     type: string
79     default: build testHosted -x testSpringCoat -x testSpringCoatRelease -x testSpringCoatDebug -x javadoc -x javadocJar -x sourcesJar -x markdownJavaDoc
81 # Commands that are used by almost everything
82 commands:
83   # Save Gradle cache and such so subsequent builds are faster
84   persist-gradle:
85     steps:
86       - persist_to_workspace:
87           root: .
88           paths:
89             - '.gradle/*'
90             - 'build/*'
91             - '*/.gradle/*'
92             - '*/build/*'
93             - '*/*/build/*'
95   # Saving of test results, since this is duplicated for many OSes
96   save-test-results:
97     parameters:
98       where:
99         type: string
100       os:
101         type: string
102       vm:
103         type: string
104       shell:
105         type: string
106         default: "/bin/bash"
107       home:
108         type: string
109         default: ./.no-persist/
110       find:
111         type: string
112         default: find
113       store-home:
114         type: string
115         default: ./.no-persist/
116     steps:
117       - run:
118           shell: <<parameters.shell>>
119           name: Save test results
120           command: |
121             mkdir -p "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/"
122             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>-<<parameters.where>>/" \;
123           when: always
124       - run:
125           shell: <<parameters.shell>>
126           name: Save test results
127           command: |
128             mkdir -p "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/"
129             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>-<<parameters.where>>/" \;
130           when: always
131       - run:
132           shell: <<parameters.shell>>
133           name: Save snapshots
134           command: |
135             mkdir -p "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/"
136             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>-<<parameters.where>>/" \;
137           when: always
138       - store_test_results:
139           path: <<parameters.store-home>>/test-results
140       - store_artifacts:
141           path: <<parameters.store-home>>/test-results
143   # Install standard packages in Debian/Ubuntu
144   linux-install-required:
145     steps:
146       - run:
147           name: Update package lists
148           command: sudo apt-get update -y
149       - run:
150           name: Install required dependencies
151           command: sudo apt-get install -y --no-install-recommends cmake build-essential curl wget openjdk-11-jdk gcc g++ make
153 jobs:
154   ################################## WINDOWS #################################
155   build_windows:
156     executor:
157       name: win/default
158       shell: cmd.exe
159       size: medium
160     environment:
161       # Use a reduced amount of memory to all the VMs so that it does not
162       # try grabbing all the memory that is available to the system.
163       JAVA_OPTS: -Xmx3g
164     steps:
165       - checkout
166       - run:
167           shell: cmd.exe
168           name: Gradle Build and Test
169           # According to documentation, Gradle on Windows has trouble and tries
170           # to make way too many workers which causes extreme resource.
171           # contention --max-workers=2
172           command: gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
173           no_output_timeout: 30m
174       - persist-gradle
175       - save-test-results:
176           where: "vm-test-hosted-debug"
177           os: "windows"
178           vm: "hosted"
179           shell: bash.exe
180           find: /usr/bin/find
181           home: "/c/users/circleci/"
182           store-home: "c:/users/circleci/"
183       - save-test-results:
184           where: "vm-test-hosted-release"
185           os: "windows"
186           vm: "hosted"
187           shell: bash.exe
188           find: /usr/bin/find
189           home: "/c/users/circleci/"
190           store-home: "c:/users/circleci/"
192   build_windows_standalone:
193     executor:
194       name: win/default
195       shell: cmd.exe
196       size: medium
197     environment:
198       # Use a reduced amount of memory to all the VMs so that it does not
199       # try grabbing all the memory that is available to the system.
200       JAVA_OPTS: -Xmx3g
201     steps:
202       - checkout
203       - attach_workspace:
204           at: .
205       - run:
206           shell: bash.exe
207           name: Construct Standalone
208           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
209       - run:
210           shell: bash.exe
211           name: Remove distracting JAR, if any
212           command: rm emulators/standalone/build/libs/standalone-*.jar
213       - store_artifacts:
214           path: emulators/standalone/build/libs/
215           destination: .
217   ratufacoat_build_windows:
218     executor:
219       name: win/default
220       shell: cmd.exe
221       size: medium
222     environment:
223       # Use a reduced amount of memory to all the VMs so that it does not
224       # try grabbing all the memory that is available to the system.
225       JAVA_OPTS: -Xmx3g
226     steps:
227       - checkout
228       - attach_workspace:
229           at: .
230       - run:
231           name: Install required dependencies
232           working_directory: ratufacoat
233           shell: cmd.exe
234           command: choco install cmake.install
235       - run:
236           name: Setup CMake build
237           working_directory: ratufacoat
238           shell: bash.exe
239           command: |
240             "$PROGRAMFILES/CMake/bin/cmake.exe" .
241       - run:
242           name: Compile CMake build
243           working_directory: ratufacoat
244           shell: bash.exe
245           command: |
246             "$PROGRAMFILES/CMake/bin/cmake.exe" --build .
247       - store_artifacts:
248           path: ratufacoat\src\Debug\SquirrelJME.exe
249           destination: SquirrelJME.exe
251   ################################# MAC OS X #################################
252   build_macosx:
253     executor: build-on-macos
254     steps:
255       - checkout
256       - run:
257           # Only OpenJDK is required, Gradle always uses Gradle wrapper so
258           # we do not need that
259           name: Install OpenJDK 11
260           command: brew install openjdk@11 coreutils
261       - run:
262           name: Gradle Build and Test
263           command: timeout --foreground 30m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
264           no_output_timeout: 30m
265       - persist-gradle
266       - save-test-results:
267           where: "vm-test-hosted-debug"
268           os: "macosx"
269           vm: "hosted"
270       - save-test-results:
271           where: "vm-test-hosted-release"
272           os: "macosx"
273           vm: "hosted"
274   build_macosx_m1:
275     executor: build-on-macos-m1
276     steps:
277       - checkout
278       - run:
279           name: Gradle Build and Test
280           command: timeout --foreground 30m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
281           no_output_timeout: 30m
282       - persist-gradle
283       - save-test-results:
284           where: "vm-test-hosted-debug"
285           os: "macosx-m1"
286           vm: "hosted"
287       - save-test-results:
288           where: "vm-test-hosted-release"
289           os: "macosx-m1"
290           vm: "hosted"
292   build_macosx_standalone:
293     executor: build-on-macos
294     steps:
295       - checkout
296       - run:
297           # Only OpenJDK is required, Gradle always uses Gradle wrapper so
298           # we do not need that
299           name: Install OpenJDK 11
300           command: brew install openjdk@11 coreutils
301       - attach_workspace:
302           at: .
303       - run:
304           name: Construct Standalone
305           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
306       - run:
307           name: Remove distracting JAR, if any
308           command: rm emulators/standalone/build/libs/standalone-*.jar
309       - store_artifacts:
310           path: emulators/standalone/build/libs/
311           destination: .
312   build_macosx_m1_standalone:
313     executor: build-on-macos-m1
314     steps:
315       - checkout
316       - attach_workspace:
317           at: .
318       - run:
319           name: Construct Standalone
320           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
321       - run:
322           name: Remove distracting JAR, if any
323           command: rm emulators/standalone/build/libs/standalone-*.jar
324       - store_artifacts:
325           path: emulators/standalone/build/libs/
326           destination: .
328   ratufacoat_build_macosx:
329     executor: build-on-macos
330     steps:
331       - checkout
332       - run:
333           name: Install CMake
334           command: brew install cmake coreutils
335       - attach_workspace:
336           at: .
337       - run:
338           name: Setup CMake build
339           working_directory: ratufacoat
340           command: cmake .
341       - run:
342           name: Compile CMake build
343           working_directory: ratufacoat
344           command: cmake --build .
345       - store_artifacts:
346           path: ratufacoat/src/SquirrelJME
347           destination: SquirrelJME
349   ################################### LINUX ##################################
350   build_linux_amd64:
351     executor: build-on-linux-amd64
352     steps:
353       - checkout
354       - linux-install-required
355       - run:
356           name: Gradle Build and Test
357           command: timeout --foreground 30m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
358           no_output_timeout: 30m
359       - save-test-results:
360           where: "vm-test-hosted-debug"
361           os: "linux-amd64"
362           vm: "hosted"
363       - save-test-results:
364           where: "vm-test-hosted-release"
365           os: "linux-amd64"
366           vm: "hosted"
367       - persist-gradle
368   build_linux_amd64_standalone:
369     executor: build-on-linux-amd64
370     steps:
371       - checkout
372       - linux-install-required
373       - attach_workspace:
374           at: .
375       - run:
376           name: Construct Standalone
377           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
378       - run:
379           name: Remove distracting JAR, if any
380           command: rm emulators/standalone/build/libs/standalone-*.jar
381       - store_artifacts:
382           path: emulators/standalone/build/libs/
383           destination: .
385   build_linux_arm64:
386     executor: build-on-linux-arm64
387     steps:
388       - checkout
389       - linux-install-required
390       - run:
391           name: Gradle Build and Test
392           command: timeout --foreground 30m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
393           no_output_timeout: 30m
394       - save-test-results:
395           where: "vm-test-hosted-debug"
396           os: "linux-arm64"
397           vm: "hosted"
398       - save-test-results:
399           where: "vm-test-hosted-release"
400           os: "linux-arm64"
401           vm: "hosted"
402       - persist-gradle
403   build_linux_arm64_standalone:
404     executor: build-on-linux-arm64
405     steps:
406       - checkout
407       - linux-install-required
408       - attach_workspace:
409           at: .
410       - run:
411           name: Construct Standalone
412           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
413       - run:
414           name: Remove distracting JAR, if any
415           command: rm emulators/standalone/build/libs/standalone-*.jar
416       - store_artifacts:
417           path: emulators/standalone/build/libs/
418           destination: .
420   ### OSS SonaType Nexus
421   sonatype_publish:
422     executor: build-on-linux-amd64
423     steps:
424       - checkout
425       - linux-install-required
426       - attach_workspace:
427           at: .
428       - run:
429           name: Publish to OSS SonaType
430           command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
432   ### RatufaCoat
433   ratufacoat_build_linux:
434     executor: build-on-linux-amd64
435     steps:
436       - checkout
437       - linux-install-required
438       - attach_workspace:
439           at: .
440       - run:
441           name: Setup CMake build
442           working_directory: ratufacoat
443           command: cmake .
444       - run:
445           name: Compile CMake build
446           working_directory: ratufacoat
447           command: cmake --build .
448       - store_artifacts:
449           path: ratufacoat/src/SquirrelJME
450           destination: SquirrelJME
452   ### SpringCoat
453   test_springcoat_debug:
454     executor: build-on-linux-amd64
455     steps:
456       - checkout
457       - linux-install-required
458       - attach_workspace:
459           at: .
460       - run:
461           name: SpringCoat Tests
462           command: timeout --foreground 30m ./gradlew testSpringCoatDebug <<pipeline.parameters.standard-gradle-options>>
463           no_output_timeout: 30m
464       - save-test-results:
465           where: "vm-test-springcoat-debug"
466           os: "linux"
467           vm: "springcoat"
468   test_springcoat_release:
469     executor: build-on-linux-amd64
470     steps:
471       - checkout
472       - linux-install-required
473       - attach_workspace:
474           at: .
475       - run:
476           name: SpringCoat Tests
477           command: timeout --foreground 30m ./gradlew testSpringCoatRelease <<pipeline.parameters.standard-gradle-options>>
478           no_output_timeout: 30m
479       - save-test-results:
480           where: "vm-test-springcoat-release"
481           os: "linux"
482           vm: "springcoat"
484   test_summercoat:
485     executor: build-on-linux-amd64
486     steps:
487       - checkout
488       - linux-install-required
489       - attach_workspace:
490           at: .
491       - run:
492           name: SummerCoat Tests
493           command: timeout --foreground 30m ./gradlew testSummerCoat <<pipeline.parameters.standard-gradle-options>>
494           no_output_timeout: 30m
495       - save-test-results:
496           where: "vm-test-summercoat-debug"
497           os: "linux"
498           vm: "summercoat"
499       - save-test-results:
500           where: "vm-test-summercoat-release"
501           os: "linux"
502           vm: "summercoat"
504   ################################### USERS ##################################
505   export_user_guide:
506     executor: build-on-linux-amd64
507     steps:
508       - checkout
509       - linux-install-required
510       - run:
511           name: Checkout Wiki
512           command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
513       - run:
514           name: Wikify
515           command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
516       - run:
517           name: Update Git User
518           command: |
519             cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
520       - run:
521           name: Commit changes
522           command: |
523             cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
524       - add_ssh_keys:
525           fingerprints:
526             - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
527       - run:
528           name: Push changes
529           command: |
530             cd "/tmp/wiki" && git push
532   ################################ CONSTRUCTION ###############################
533   # Runs the `testJar` task so any operations following this will run faster
534   # when they need to use these JARs
535   construct_testJars:
536     executor: build-on-linux-amd64
537     steps:
538       - checkout
539       - linux-install-required
540       - attach_workspace:
541           at: .
542       - run:
543           name: Construct Test JARs
544           command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
545       - persist-gradle
547   # Constructs the ROM fragment libraries for SummerCoat, since they are used
548   # for general ROM construction
549   construct_libSummerCoat:
550     executor: build-on-linux-amd64
551     steps:
552       - checkout
553       - linux-install-required
554       - attach_workspace:
555           at: .
556       - run:
557           name: Construct SummerCoat Libraries
558           command: ./gradlew libSummerCoat <<pipeline.parameters.standard-gradle-options>>
559       - persist-gradle
561   # All the tests so that they can run from within SummerCoat
562   construct_libTestSummerCoat:
563     executor: build-on-linux-amd64
564     steps:
565       - checkout
566       - linux-install-required
567       - attach_workspace:
568           at: .
569       - run:
570           name: Construct Test SummerCoat Libraries
571           command: ./gradlew libTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
572       - persist-gradle
574   # Constructs the standard SummerCoat ROM, could be uploaded later
575   construct_romSummerCoat:
576     executor: build-on-linux-amd64
577     steps:
578       - checkout
579       - linux-install-required
580       - attach_workspace:
581           at: .
582       - run:
583           name: Construct SummerCoat ROM
584           command: ./gradlew romSummerCoat <<pipeline.parameters.standard-gradle-options>>
585       - persist-gradle
587   # Constructs the test SummerCoat ROM, could be uploaded later, this is so
588   # that any RatufaCoats have an actual ROM that can be tested to ensure that
589   # it properly works.
590   construct_romTestSummerCoat:
591     executor: build-on-linux-amd64
592     steps:
593       - checkout
594       - linux-install-required
595       - attach_workspace:
596           at: .
597       - run:
598           name: Construct Test SummerCoat ROM
599           command: ./gradlew romTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
600       - persist-gradle
602 workflows:
603   version: 2
604   tests:
605     jobs:
606       ############################# STANDARD TESTS ############################
607       - build_linux_amd64
608 #      - build_linux_arm64
609       - test_springcoat_debug:
610           requires:
611             - construct_testJars
612       - test_springcoat_release:
613           requires:
614             - construct_testJars
615 #      - test_summercoat:
616 #          requires:
617 #            - construct_libTestSummerCoat
618       - build_linux_amd64_standalone:
619            requires:
620              - build_linux_amd64
621 #      - build_linux_arm64_standalone:
622 #          requires:
623 #            - build_linux_arm64
625       # Mac OS X runs decently however the jobs for it have a higher cost, so
626       # only perform builds and tests for trunk to lower costs.
627       # Currently I have an overabundance of credits...
628       - build_macosx
629 #          filters:
630 #            branches:
631 #              only:
632 #                - trunk
633       - build_macosx_m1
634 #          filters:
635 #            branches:
636 #              only:
637 #                - trunk
638       - build_macosx_standalone:
639            requires:
640              - build_macosx
641       - build_macosx_m1_standalone:
642            requires:
643              - build_macosx_m1
645       # Building on Windows is currently expensive and takes longer, so only
646       # run these builds on trunk to lower costs.
647       # Currently have an overabundance of credits...
648       - build_windows
649 #          requires:
650 #            - build_linux
651 #          filters:
652 #            branches:
653 #              only:
654 #                - trunk
655       - build_windows_standalone:
656            requires:
657              - build_windows
659       # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
660       - sonatype_publish:
661           requires:
662             - build_linux_amd64
663           filters:
664             branches:
665               only:
666                 - trunk
667                 - wip-centralpublish
669       ###################### LIBRARY AND ROM CONSTRUCTION #####################
670       - construct_testJars:
671           requires:
672             - build_linux_amd64
673 #      - construct_libSummerCoat:
674 #          requires:
675 #            - build_linux_amd64
676 #      - construct_libTestSummerCoat:
677 #          requires:
678 #            - construct_testJars
679 #      - construct_romSummerCoat:
680 #          requires:
681 #            - construct_libSummerCoat
682 #      - construct_romTestSummerCoat:
683 #          requires:
684 #            - construct_libTestSummerCoat
686       ############################## RATUFACOAT ##############################
687 #      - ratufacoat_build_windows:
688 #          requires:
689 #            - build_windows
690 #            - construct_romTestSummerCoat
691 #      - ratufacoat_build_linux:
692 #          requires:
693 #            - build_linux_amd64
694 #            - construct_romTestSummerCoat
695 #      - ratufacoat_build_macosx:
696 #          requires:
697 #            - build_macosx
698 #            - construct_romTestSummerCoat
700   #################### TASKS TO INCREASE USER FRIENDLINESS ####################
701   friendliness:
702     jobs:
703       - export_user_guide:
704           filters:
705             branches:
706               only:
707                 - trunk
708                 - wip-userguide