]> cat aescling's git repositories - mastodon.git/commitdiff
CI: Support larger diff artifacts
authoraescling <aescling+gitlab@cat.family>
Mon, 29 Aug 2022 06:56:35 +0000 (02:56 -0400)
committeraescling <aescling+gitlab@cat.family>
Mon, 5 Sep 2022 04:28:03 +0000 (00:28 -0400)
(Much too large) MRs can theoretically exceed the artifact size limit
for dotenv files; this ought to be more flexible for us.

A previous attempt just invoked deno as needed per stage, but this
involved installing deno as needed in non-deno images, and would be
ineffecient if we ever need the other diffs in any stage.

.gitlab-ci.yml

index ae36052c355c6d2f936abd69e26d7c4ce9666b98..bee338a39aa7a654e8cee9480fe339bb906157c6 100644 (file)
@@ -82,15 +82,20 @@ diff:
         { all: [], rb: [], js: [] },
       );
       Deno.writeTextFileSync(
-        'build.env',
-        'CHANGED_FILES=' + all.join(' ') + String.fromCodePoint(0x0A) +
-          'CHANGED_RUBY=' + rb.join(' ') + String.fromCodePoint(0x0A) +
-          'CHANGED_JS=' + js.join(' ') + String.fromCodePoint(0x0A),
+        'diff-all.txt', all.join(' ') + String.fromCodePoint(0x0A)
+      );
+      Deno.writeTextFileSync(
+        'diff-rb.txt', rb.join(' ') + String.fromCodePoint(0x0A)
+      );
+      Deno.writeTextFileSync(
+        'diff-js.txt', js.join(' ') + String.fromCodePoint(0x0A)
       );"
-    - cat build.env
+    - 'cat diff-*.txt'
   artifacts:
-    reports:
-      dotenv: build.env
+    paths:
+      - diff-all.txt
+      - diff-rb.txt
+      - diff-js.txt
 
 build:
   stage: build
@@ -106,7 +111,7 @@ build:
 lint:
   stage: test
   script:
-    - 'if [ ! -z "$CHANGED_RUBY" ]; then bundle exec standardrb $CHANGED_RUBY; fi'
+    - 'if [ "$(exec wc -c <diff-rb.txt)" -gt 1 ]; then bundle exec standardrb $(exec cat diff-rb.txt); fi' # newline is always present
   allow_failure: true
 
 test: