From dfb0cd2262db3923cf927ea73134d61c6e228b46 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Feb 2021 09:46:25 +0100 Subject: [PATCH] chore(gitlab-ci): separate running of tests --- .gitlab-ci.yml | 138 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 121 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0100fab5b..9a6d0f17f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,16 +97,11 @@ frontend:lint: interruptible: true yesod:build:dev: - services: &build-services - - name: postgres:10.10 - alias: postgres - - name: minio/minio:RELEASE.2020-08-27T05-16-20Z - alias: minio - command: ["minio", "server", "/data"] - stage: yesod:build script: - - stack build --test --copy-bins --local-bin-path $(pwd)/bin --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic --no-strip + - stack build --test --copy-bins --local-bin-path $(pwd)/bin --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic --no-strip --no-run-tests + - cp $(stack path --dist-dir)/build/hlint/hlint bin/test-hlint + - cp $(stack path --dist-dir)/build/yesod/yesod bin/test-yesod needs: - job: npm install # transitive artifacts: false @@ -134,17 +129,17 @@ yesod:build:dev: - if: $CI_COMMIT_REF_NAME =~ /(^v[0-9].*)|((^|\/)profile($|\/))/ when: manual allow_failure: true - - when: always + - when: on_success retry: 2 interruptible: true yesod:build: - services: *build-services - stage: yesod:build script: - - stack build --test --copy-bins --local-bin-path $(pwd)/bin --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic --no-strip + - stack build --test --copy-bins --local-bin-path $(pwd)/bin --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic --no-strip --no-run-tests + - cp $(stack path --dist-dir)/build/hlint/hlint bin/test-hlint + - cp $(stack path --dist-dir)/build/yesod/yesod bin/test-yesod needs: - job: npm install # transitive artifacts: false @@ -158,7 +153,7 @@ yesod:build: rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - when: always + when: on_success - when: manual allow_failure: true @@ -187,7 +182,7 @@ yesod:build:profile: rules: - if: $CI_COMMIT_REF_NAME =~ /(^|\/)profile($|\/)/ - when: always + when: on_success - when: manual allow_failure: true @@ -195,6 +190,107 @@ yesod:build:profile: interruptible: true resource_group: ram +yesod:test:yesod: + stage: test + cache: {} + + services: &test-services + - name: postgres:10.10 + alias: postgres + - name: minio/minio:RELEASE.2020-08-27T05-16-20Z + alias: minio + command: ["minio", "server", "/data"] + + needs: + - job: npm install # transitive + artifacts: false + - job: frontend:build #transitive + artifacts: false + - job: yesod:build + artifacts: true + + rules: + - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + when: on_success + + script: + - bin/test-yesod + + retry: 2 + interruptible: true + +yesod:test:yesod:dev: + stage: test + cache: {} + + services: *test-services + + needs: + - job: npm install # transitive + artifacts: false + - job: frontend:build #transitive + artifacts: false + - job: yesod:build:dev + artifacts: true + + rules: + - if: $CI_COMMIT_REF_NAME =~ /(^v[0-9].*)|((^|\/)profile($|\/))/ + when: manual + allow_failure: true + - when: on_success + + script: + - bin/test-yesod + + retry: 2 + interruptible: true + +yesod:test:hlint: + stage: test + cache: {} + + needs: + - job: npm install # transitive + artifacts: false + - job: frontend:build #transitive + artifacts: false + - job: yesod:build + artifacts: true + + rules: + - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + when: on_success + + script: + - bin/test-hlint + + retry: 2 + interruptible: true + +yesod:test:hlint:dev: + stage: test + cache: {} + + needs: + - job: npm install # transitive + artifacts: false + - job: frontend:build #transitive + artifacts: false + - job: yesod:build:dev + artifacts: true + + rules: + - if: $CI_COMMIT_REF_NAME =~ /(^v[0-9].*)|((^|\/)profile($|\/))/ + when: manual + allow_failure: true + - when: on_success + + script: + - bin/test-hlint + + retry: 2 + interruptible: true + frontend:test: cache: <<: *global_cache @@ -226,7 +322,7 @@ parse-changelog: artifacts: true rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - when: always + when: on_success before_script: - rm -rvf /etc/apt/sources.list /etc/apt/sources.list.d - install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list @@ -266,9 +362,13 @@ upload: artifacts: false - job: frontend:test # validation artifacts: false + - job: yesod:test:hlint # validation + artifacts: false + - job: yesod:test:yesod # validation + artifacts: false rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - when: always + when: on_success before_script: - export VERSION="$(cat .current-version)" script: @@ -302,9 +402,13 @@ release: artifacts: false - job: frontend:test # validation artifacts: false + - job: yesod:test:hlint # validation + artifacts: false + - job: yesod:test:yesod # validation + artifacts: false rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - when: always + when: on_success before_script: - export VERSION="$(cat .current-version)" script: