]> Untitled Git - lemmy.git/commitdiff
Fix & Optimize CI config (#2802)
author6543 <6543@obermui.de>
Thu, 13 Apr 2023 20:33:00 +0000 (22:33 +0200)
committerGitHub <noreply@github.com>
Thu, 13 Apr 2023 20:33:00 +0000 (22:33 +0200)
* let the clone plugin handle submodules too

* start using yml aliase

* fix publish_to_crates_io

* CI.restart()

.woodpecker.yml

index 9b96c52dedb14e0aebacff98072aaafedeccc510..adeeffd87f2a507cc1f7e95ab11974d37c668413 100644 (file)
@@ -1,18 +1,20 @@
 # TODO: The when: platform conditionals aren't working currently
 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
 
+variables:
+  - &muslrust_image 'clux/muslrust:1.67.0'
+
+clone:
+  git:
+    image: woodpeckerci/plugin-git
+    settings:
+      recursive: true
+      submodule_update_remote: true
+
 pipeline:
   # use minimum supported rust version for most steps
-  prepare_repo:
-    image: alpine:3
-    commands:
-      - apk add git
-        #- git fetch --tags
-      - git submodule init
-      - git submodule update --recursive --remote
-
   cargo_fmt:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       # store cargo data in repo folder so that it gets cached between steps
       CARGO_HOME: .cargo
@@ -28,7 +30,7 @@ pipeline:
   # check each package to make sure they compile with default features.
   # this is required for crates.io
   cargo_check:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       CARGO_HOME: .cargo
     commands:
@@ -50,7 +52,7 @@ pipeline:
     #   platform: linux/amd64
 
   cargo_clippy:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       CARGO_HOME: .cargo
     commands:
@@ -74,7 +76,7 @@ pipeline:
     #   platform: linux/amd64
 
   lemmy_api_common_doesnt_depend_on_diesel:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       CARGO_HOME: .cargo
     commands:
@@ -83,7 +85,7 @@ pipeline:
     #   platform: linux/amd64
 
   check_defaults_hjson_updated:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       CARGO_HOME: .cargo
     commands:
@@ -94,7 +96,7 @@ pipeline:
     #   platform: linux/amd64
 
   cargo_test:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
       RUST_BACKTRACE: "1"
@@ -107,7 +109,7 @@ pipeline:
     #   platform: linux/amd64
 
   cargo_build:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     environment:
       CARGO_HOME: .cargo
     commands:
@@ -216,11 +218,11 @@ pipeline:
 
   # using https://github.com/pksunkara/cargo-workspaces
   publish_to_crates_io:
-    image: clux/muslrust:1.67.0
+    image: *muslrust_image
     commands:
       - cargo install cargo-workspaces
       - cp -r migrations crates/db_schema/
-      - cargo login "$CARGO_TOKEN"
+      - cargo login "$CARGO_API_TOKEN"
       - cargo workspaces publish --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
     secrets: [cargo_api_token]
     when: