Marking of more classes, might get rid of in the future and optimize; Implement shrin...
[SquirrelJME.git] / .circleci / config.yml
blob7eab244d92713685204b620784882f86dfe8bc36
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 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>>/"
122             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/junit/.*\.xml' -exec cp {} "<<parameters.home>>/test-results/junit-<<parameters.os>>/" \;
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>>/"
129             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/csv/.*\.csv' -exec cp {} "<<parameters.home>>/test-results/csv-<<parameters.os>>/" \;
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>>/"
136             <<parameters.find>> . -type f -regex '.*/'"<<parameters.where>>"'/nps/.*\.nps' -exec cp {} "<<parameters.home>>/test-results/nps-<<parameters.vm>>-<<parameters.os>>/" \;
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: 7m
174       - persist-gradle
175       - save-test-results:
176           where: "vm-test-hosted"
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/"
184   build_windows_standalone:
185     executor:
186       name: win/default
187       shell: cmd.exe
188       size: medium
189     environment:
190       # Use a reduced amount of memory to all the VMs so that it does not
191       # try grabbing all the memory that is available to the system.
192       JAVA_OPTS: -Xmx3g
193     steps:
194       - checkout
195       - attach_workspace:
196           at: .
197       - run:
198           shell: bash.exe
199           name: Construct Standalone
200           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options >>
201       - run:
202           shell: bash.exe
203           name: Remove distracting JAR, if any
204           command: rm emulators/standalone/build/libs/standalone-*.jar
205       - store_artifacts:
206           path: emulators/standalone/build/libs/
207           destination: .
209   ratufacoat_build_windows:
210     executor:
211       name: win/default
212       shell: cmd.exe
213       size: medium
214     environment:
215       # Use a reduced amount of memory to all the VMs so that it does not
216       # try grabbing all the memory that is available to the system.
217       JAVA_OPTS: -Xmx3g
218     steps:
219       - checkout
220       - attach_workspace:
221           at: .
222       - run:
223           name: Install required dependencies
224           working_directory: ratufacoat
225           shell: cmd.exe
226           command: choco install cmake.install
227       - run:
228           name: Setup CMake build
229           working_directory: ratufacoat
230           shell: bash.exe
231           command: |
232             "$PROGRAMFILES/CMake/bin/cmake.exe" .
233       - run:
234           name: Compile CMake build
235           working_directory: ratufacoat
236           shell: bash.exe
237           command: |
238             "$PROGRAMFILES/CMake/bin/cmake.exe" --build .
239       - store_artifacts:
240           path: ratufacoat\src\Debug\SquirrelJME.exe
241           destination: SquirrelJME.exe
243   ################################# MAC OS X #################################
244   build_macosx:
245     executor: build-on-macos
246     steps:
247       - checkout
248       - run:
249           # Only OpenJDK is required, Gradle always uses Gradle wrapper so
250           # we do not need that
251           name: Install OpenJDK 11
252           command: brew install openjdk@11 coreutils
253       - run:
254           name: Gradle Build and Test
255           command: timeout --foreground 7m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
256           no_output_timeout: 7m
257       - persist-gradle
258       - save-test-results:
259           where: "vm-test-hosted"
260           os: "macosx"
261           vm: "hosted"
262   build_macosx_m1:
263     executor: build-on-macos-m1
264     steps:
265       - checkout
266       - run:
267           name: Gradle Build and Test
268           command: timeout --foreground 7m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
269           no_output_timeout: 7m
270       - persist-gradle
271       - save-test-results:
272           where: "vm-test-hosted"
273           os: "macosx-m1"
274           vm: "hosted"
276   build_macosx_standalone:
277     executor: build-on-macos
278     steps:
279       - checkout
280       - run:
281           # Only OpenJDK is required, Gradle always uses Gradle wrapper so
282           # we do not need that
283           name: Install OpenJDK 11
284           command: brew install openjdk@11 coreutils
285       - attach_workspace:
286           at: .
287       - run:
288           name: Construct Standalone
289           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
290       - run:
291           name: Remove distracting JAR, if any
292           command: rm emulators/standalone/build/libs/standalone-*.jar
293       - store_artifacts:
294           path: emulators/standalone/build/libs/
295           destination: .
296   build_macosx_m1_standalone:
297     executor: build-on-macos-m1
298     steps:
299       - checkout
300       - attach_workspace:
301           at: .
302       - run:
303           name: Construct Standalone
304           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
305       - run:
306           name: Remove distracting JAR, if any
307           command: rm emulators/standalone/build/libs/standalone-*.jar
308       - store_artifacts:
309           path: emulators/standalone/build/libs/
310           destination: .
312   ratufacoat_build_macosx:
313     executor: build-on-macos
314     steps:
315       - checkout
316       - run:
317           name: Install CMake
318           command: brew install cmake coreutils
319       - attach_workspace:
320           at: .
321       - run:
322           name: Setup CMake build
323           working_directory: ratufacoat
324           command: cmake .
325       - run:
326           name: Compile CMake build
327           working_directory: ratufacoat
328           command: cmake --build .
329       - store_artifacts:
330           path: ratufacoat/src/SquirrelJME
331           destination: SquirrelJME
333   ################################### LINUX ##################################
334   build_linux_amd64:
335     executor: build-on-linux-amd64
336     steps:
337       - checkout
338       - linux-install-required
339       - run:
340           name: Gradle Build and Test
341           command: timeout --foreground 7m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
342           no_output_timeout: 7m
343       - save-test-results:
344           where: "vm-test-hosted"
345           os: "linux-amd64"
346           vm: "hosted"
347       - persist-gradle
348   build_linux_amd64_standalone:
349     executor: build-on-linux-amd64
350     steps:
351       - checkout
352       - linux-install-required
353       - attach_workspace:
354           at: .
355       - run:
356           name: Construct Standalone
357           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
358       - run:
359           name: Remove distracting JAR, if any
360           command: rm emulators/standalone/build/libs/standalone-*.jar
361       - store_artifacts:
362           path: emulators/standalone/build/libs/
363           destination: .
365   build_linux_arm64:
366     executor: build-on-linux-arm64
367     steps:
368       - checkout
369       - linux-install-required
370       - run:
371           name: Gradle Build and Test
372           command: timeout --foreground 7m ./gradlew <<pipeline.parameters.standard-build-options>> <<pipeline.parameters.standard-gradle-options>>
373           no_output_timeout: 7m
374       - save-test-results:
375           where: "vm-test-hosted"
376           os: "linux-arm64"
377           vm: "hosted"
378       - persist-gradle
379   build_linux_arm64_standalone:
380     executor: build-on-linux-arm64
381     steps:
382       - checkout
383       - linux-install-required
384       - attach_workspace:
385           at: .
386       - run:
387           name: Construct Standalone
388           command: ./gradlew :emulators:standalone:shadowJar <<pipeline.parameters.standard-gradle-options>>
389       - run:
390           name: Remove distracting JAR, if any
391           command: rm emulators/standalone/build/libs/standalone-*.jar
392       - store_artifacts:
393           path: emulators/standalone/build/libs/
394           destination: .
396   ### OSS SonaType Nexus
397   sonatype_publish:
398     executor: build-on-linux-amd64
399     steps:
400       - checkout
401       - linux-install-required
402       - attach_workspace:
403           at: .
404       - run:
405           name: Publish to OSS SonaType
406           command: ./gradlew publishMavenPublicationToMavenRepository <<pipeline.parameters.standard-gradle-options>> || circleci-agent step halt
408   ### RatufaCoat
409   ratufacoat_build_linux:
410     executor: build-on-linux-amd64
411     steps:
412       - checkout
413       - linux-install-required
414       - attach_workspace:
415           at: .
416       - run:
417           name: Setup CMake build
418           working_directory: ratufacoat
419           command: cmake .
420       - run:
421           name: Compile CMake build
422           working_directory: ratufacoat
423           command: cmake --build .
424       - store_artifacts:
425           path: ratufacoat/src/SquirrelJME
426           destination: SquirrelJME
428   ### SpringCoat
429   test_springcoat:
430     executor: build-on-linux-amd64
431     steps:
432       - checkout
433       - linux-install-required
434       - attach_workspace:
435           at: .
436       - run:
437           name: SpringCoat Tests
438           command: timeout --foreground 17m ./gradlew testSpringCoat <<pipeline.parameters.standard-gradle-options>>
439           no_output_timeout: 17m
440       - save-test-results:
441           where: "vm-test-springcoat"
442           os: "linux"
443           vm: "springcoat"
444   test_summercoat:
445     executor: build-on-linux-amd64
446     steps:
447       - checkout
448       - linux-install-required
449       - attach_workspace:
450           at: .
451       - run:
452           name: SummerCoat Tests
453           command: timeout --foreground 15m ./gradlew testSummerCoat <<pipeline.parameters.standard-gradle-options>>
454           no_output_timeout: 15m
455       - save-test-results:
456           where: "vm-test-summercoat"
457           os: "linux"
458           vm: "summercoat"
460   ################################### USERS ##################################
461   export_user_guide:
462     executor: build-on-linux-amd64
463     steps:
464       - checkout
465       - linux-install-required
466       - run:
467           name: Checkout Wiki
468           command: git clone git@github.com:SquirrelJME/SquirrelJME.wiki.git /tmp/wiki
469       - run:
470           name: Wikify
471           command: .circleci/squirreljme-wikify-user-guide.sh "$(pwd)" "/tmp/wiki"
472       - run:
473           name: Update Git User
474           command: |
475             cd "/tmp/wiki" && git config user.name "SquirrelJME Automation" && git config user.email "xerthesquirrel+squirreljme@gmail.com"
476       - run:
477           name: Commit changes
478           command: |
479             cd "/tmp/wiki" && git commit -m "Synchronize User-Guide" || echo "Ignoring commit."
480       - add_ssh_keys:
481           fingerprints:
482             - "26:b8:ae:4d:53:64:4c:6a:59:3d:a6:60:44:90:9d:6c"
483       - run:
484           name: Push changes
485           command: |
486             cd "/tmp/wiki" && git push
488   ################################ CONSTRUCTION ###############################
489   # Runs the `testJar` task so any operations following this will run faster
490   # when they need to use these JARs
491   construct_testJars:
492     executor: build-on-linux-amd64
493     steps:
494       - checkout
495       - linux-install-required
496       - attach_workspace:
497           at: .
498       - run:
499           name: Construct Test JARs
500           command: ./gradlew testJar <<pipeline.parameters.standard-gradle-options>>
501       - persist-gradle
503   # Constructs the ROM fragment libraries for SummerCoat, since they are used
504   # for general ROM construction
505   construct_libSummerCoat:
506     executor: build-on-linux-amd64
507     steps:
508       - checkout
509       - linux-install-required
510       - attach_workspace:
511           at: .
512       - run:
513           name: Construct SummerCoat Libraries
514           command: ./gradlew libSummerCoat <<pipeline.parameters.standard-gradle-options>>
515       - persist-gradle
517   # All the tests so that they can run from within SummerCoat
518   construct_libTestSummerCoat:
519     executor: build-on-linux-amd64
520     steps:
521       - checkout
522       - linux-install-required
523       - attach_workspace:
524           at: .
525       - run:
526           name: Construct Test SummerCoat Libraries
527           command: ./gradlew libTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
528       - persist-gradle
530   # Constructs the standard SummerCoat ROM, could be uploaded later
531   construct_romSummerCoat:
532     executor: build-on-linux-amd64
533     steps:
534       - checkout
535       - linux-install-required
536       - attach_workspace:
537           at: .
538       - run:
539           name: Construct SummerCoat ROM
540           command: ./gradlew romSummerCoat <<pipeline.parameters.standard-gradle-options>>
541       - persist-gradle
543   # Constructs the test SummerCoat ROM, could be uploaded later, this is so
544   # that any RatufaCoats have an actual ROM that can be tested to ensure that
545   # it properly works.
546   construct_romTestSummerCoat:
547     executor: build-on-linux-amd64
548     steps:
549       - checkout
550       - linux-install-required
551       - attach_workspace:
552           at: .
553       - run:
554           name: Construct Test SummerCoat ROM
555           command: ./gradlew romTestSummerCoat <<pipeline.parameters.standard-gradle-options>>
556       - persist-gradle
558 workflows:
559   version: 2
560   tests:
561     jobs:
562       ############################# STANDARD TESTS ############################
563       - build_linux_amd64
564 #      - build_linux_arm64
565       - test_springcoat:
566           requires:
567             - construct_testJars
568 #      - test_summercoat:
569 #          requires:
570 #            - construct_libTestSummerCoat
571       - build_linux_amd64_standalone:
572            requires:
573              - build_linux_amd64
574 #      - build_linux_arm64_standalone:
575 #          requires:
576 #            - build_linux_arm64
578       # Mac OS X runs decently however the jobs for it have a higher cost, so
579       # only perform builds and tests for trunk to lower costs.
580       # Currently I have an overabundance of credits...
581       - build_macosx
582 #          filters:
583 #            branches:
584 #              only:
585 #                - trunk
586       - build_macosx_m1
587 #          filters:
588 #            branches:
589 #              only:
590 #                - trunk
591       - build_macosx_standalone:
592            requires:
593              - build_macosx
594       - build_macosx_m1_standalone:
595            requires:
596              - build_macosx_m1
598       # Building on Windows is currently expensive and takes longer, so only
599       # run these builds on trunk to lower costs.
600       # Currently have an overabundance of credits...
601       - build_windows
602 #          requires:
603 #            - build_linux
604 #          filters:
605 #            branches:
606 #              only:
607 #                - trunk
608       - build_windows_standalone:
609            requires:
610              - build_windows
612       # Publishing to OSS Sonatype Nexus (https://oss.sonatype.org)
613       - sonatype_publish:
614           requires:
615             - build_linux_amd64
616           filters:
617             branches:
618               only:
619                 - trunk
620                 - wip-centralpublish
622       ###################### LIBRARY AND ROM CONSTRUCTION #####################
623       - construct_testJars:
624           requires:
625             - build_linux_amd64
626 #      - construct_libSummerCoat:
627 #          requires:
628 #            - build_linux_amd64
629 #      - construct_libTestSummerCoat:
630 #          requires:
631 #            - construct_testJars
632 #      - construct_romSummerCoat:
633 #          requires:
634 #            - construct_libSummerCoat
635 #      - construct_romTestSummerCoat:
636 #          requires:
637 #            - construct_libTestSummerCoat
639       ############################## RATUFACOAT ##############################
640 #      - ratufacoat_build_windows:
641 #          requires:
642 #            - build_windows
643 #            - construct_romTestSummerCoat
644 #      - ratufacoat_build_linux:
645 #          requires:
646 #            - build_linux_amd64
647 #            - construct_romTestSummerCoat
648 #      - ratufacoat_build_macosx:
649 #          requires:
650 #            - build_macosx
651 #            - construct_romTestSummerCoat
653   #################### TASKS TO INCREASE USER FRIENDLINESS ####################
654   friendliness:
655     jobs:
656       - export_user_guide:
657           filters:
658             branches:
659               only:
660                 - trunk
661                 - wip-userguide