Commit 535e4adb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '339248-allow-to-test-a-canonical-mr-as-if-jihu-in-the-jihu-context-2' into 'master'

Introduce new frontend 'as-if-jh' jobs

See merge request gitlab-org/gitlab!70000
parents 284441c6 2fbc6e0b
...@@ -71,6 +71,12 @@ compile-test-assets as-if-foss: ...@@ -71,6 +71,12 @@ compile-test-assets as-if-foss:
- .frontend:rules:compile-test-assets-as-if-foss - .frontend:rules:compile-test-assets-as-if-foss
- .as-if-foss - .as-if-foss
compile-test-assets as-if-jh:
extends:
- compile-test-assets
- .frontend:rules:compile-test-assets-as-if-jh
needs: ["add-jh-folder"]
update-assets-compile-production-cache: update-assets-compile-production-cache:
extends: extends:
- compile-production-assets - compile-production-assets
...@@ -112,7 +118,7 @@ update-storybook-yarn-cache: ...@@ -112,7 +118,7 @@ update-storybook-yarn-cache:
- .rails-cache - .rails-cache
- .use-pg12 - .use-pg12
stage: fixtures stage: fixtures
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets"] needs: ["setup-test-env", "retrieve-tests-metadata"]
variables: variables:
WEBPACK_VENDOR_DLL: "true" WEBPACK_VENDOR_DLL: "true"
script: script:
...@@ -128,19 +134,38 @@ update-storybook-yarn-cache: ...@@ -128,19 +134,38 @@ update-storybook-yarn-cache:
- tmp/tests/frontend/ - tmp/tests/frontend/
- knapsack/ - knapsack/
# In gitlab-foss, generates FOSS fixtures. In gitlab, generates FOSS & EE fixtures. # Builds FOSS, and EE fixtures in the EE project.
# That way, we don't need to have two separate jobs. # Builds FOSS fixtures in the FOSS project.
rspec-all frontend_fixture: rspec-all frontend_fixture:
extends: extends:
- .frontend-fixtures-base - .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs - .frontend:rules:default-frontend-jobs
needs:
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets"
parallel: 5 parallel: 5
rspec frontend_fixture as-if-foss: # Builds FOSS fixtures in the EE project, with the `ee/` folder removed (due to `as-if-foss`).
rspec-all frontend_fixture as-if-foss:
extends: extends:
- .frontend-fixtures-base - .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-as-if-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
needs:
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets as-if-foss"
# Builds FOSS, EE, and JH fixtures in the EE project, with the `jh/` folder added (due to `as-if-jh`).
rspec-all frontend_fixture as-if-jh:
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-as-if-jh
needs:
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets as-if-jh"
- "add-jh-folder"
script:
- echo "This job is currently doing nothing since there's no specific JH fixtures yet. To enable this job, remove this line."
graphql-schema-dump: graphql-schema-dump:
variables: variables:
...@@ -168,7 +193,9 @@ graphql-schema-dump: ...@@ -168,7 +193,9 @@ graphql-schema-dump:
# Disable warnings in browserslist which can break on backports # Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384 # https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true" BROWSERSLIST_IGNORE_OLD_DATA: "true"
SETUP_DB: "false"
before_script: before_script:
- !reference [.default-before_script, before_script]
- *yarn-install - *yarn-install
stage: test stage: test
...@@ -190,9 +217,7 @@ jest: ...@@ -190,9 +217,7 @@ jest:
extends: extends:
- .jest-base - .jest-base
- .frontend:rules:jest - .frontend:rules:jest
needs: needs: ["rspec-all frontend_fixture"]
- job: "detect-tests"
- job: "rspec-all frontend_fixture"
artifacts: artifacts:
name: coverage-frontend name: coverage-frontend
expire_in: 31d expire_in: 31d
...@@ -209,6 +234,9 @@ jest minimal: ...@@ -209,6 +234,9 @@ jest minimal:
extends: extends:
- jest - jest
- .frontend:rules:jest:minimal - .frontend:rules:jest:minimal
needs:
- !reference [jest, needs]
- "detect-tests"
script: script:
- run_timed_command "yarn jest:ci:minimal" - run_timed_command "yarn jest:ci:minimal"
...@@ -227,9 +255,17 @@ jest-as-if-foss: ...@@ -227,9 +255,17 @@ jest-as-if-foss:
- .jest-base - .jest-base
- .frontend:rules:default-frontend-jobs-as-if-foss - .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss - .as-if-foss
needs: ["rspec frontend_fixture as-if-foss"] needs: ["rspec-all frontend_fixture as-if-foss"]
parallel: 2 parallel: 2
jest-as-if-jh:
extends:
- .jest-base
- .frontend:rules:default-frontend-jobs-as-if-jh
needs: ["rspec-all frontend_fixture as-if-jh", "add-jh-folder"]
script:
- echo "This job is currently doing nothing since there's no specific JH Jest tests yet. To enable this job, remove this line."
coverage-frontend: coverage-frontend:
extends: extends:
- .default-retry - .default-retry
...@@ -342,7 +378,7 @@ startup-css-check as-if-foss: ...@@ -342,7 +378,7 @@ startup-css-check as-if-foss:
- .frontend:rules:default-frontend-jobs-as-if-foss - .frontend:rules:default-frontend-jobs-as-if-foss
needs: needs:
- job: "compile-test-assets as-if-foss" - job: "compile-test-assets as-if-foss"
- job: "rspec frontend_fixture as-if-foss" - job: "rspec-all frontend_fixture as-if-foss"
.compile-storybook-base: .compile-storybook-base:
extends: extends:
...@@ -351,14 +387,15 @@ startup-css-check as-if-foss: ...@@ -351,14 +387,15 @@ startup-css-check as-if-foss:
script: script:
- *storybook-yarn-install - *storybook-yarn-install
- yarn run storybook:build - yarn run storybook:build
needs: ["graphql-schema-dump"]
compile-storybook: compile-storybook:
extends: extends:
- .compile-storybook-base - .compile-storybook-base
- .frontend:rules:default-frontend-jobs - .frontend:rules:default-frontend-jobs
needs: needs:
- !reference [.compile-storybook-base, needs]
- job: "rspec-all frontend_fixture" - job: "rspec-all frontend_fixture"
- job: "graphql-schema-dump"
artifacts: artifacts:
name: storybook name: storybook
expire_in: 31d expire_in: 31d
...@@ -372,5 +409,5 @@ compile-storybook as-if-foss: ...@@ -372,5 +409,5 @@ compile-storybook as-if-foss:
- .as-if-foss - .as-if-foss
- .frontend:rules:default-frontend-jobs-as-if-foss - .frontend:rules:default-frontend-jobs-as-if-foss
needs: needs:
- job: "graphql-schema-dump" - !reference [.compile-storybook-base, needs]
- job: "rspec frontend_fixture as-if-foss" - job: "rspec-all frontend_fixture as-if-foss"
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
.default-before_script: .default-before_script:
before_script: before_script:
- echo $FOSS_ONLY
- '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb' - '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb'
- export GOPATH=$CI_PROJECT_DIR/.go - export GOPATH=$CI_PROJECT_DIR/.go
- mkdir -p $GOPATH - mkdir -p $GOPATH
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
.if-merge-request-labels-as-if-foss: &if-merge-request-labels-as-if-foss .if-merge-request-labels-as-if-foss: &if-merge-request-labels-as-if-foss
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-as-if-foss/' if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-as-if-foss/'
.if-merge-request-labels-as-if-jh: &if-merge-request-labels-as-if-jh
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-as-if-jh/'
.if-merge-request-labels-update-caches: &if-merge-request-labels-update-caches .if-merge-request-labels-update-caches: &if-merge-request-labels-update-caches
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:update-cache/' if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:update-cache/'
...@@ -491,8 +494,19 @@ ...@@ -491,8 +494,19 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-merge-request-labels-as-if-foss
- <<: *if-merge-request-labels-run-all-rspec
- changes: *code-backstage-qa-patterns - changes: *code-backstage-qa-patterns
- changes: *startup-css-patterns
.frontend:rules:compile-test-assets-as-if-jh:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-labels-as-if-jh
- <<: *if-merge-request-labels-run-all-rspec - <<: *if-merge-request-labels-run-all-rspec
- changes: *code-backstage-qa-patterns
- changes: *startup-css-patterns
.frontend:rules:default-frontend-jobs: .frontend:rules:default-frontend-jobs:
rules: rules:
...@@ -512,6 +526,19 @@ ...@@ -512,6 +526,19 @@
- <<: *if-merge-request - <<: *if-merge-request
changes: *ci-patterns changes: *ci-patterns
.frontend:rules:default-frontend-jobs-as-if-jh:
rules:
- <<: *if-not-ee
when: never
- <<: *if-security-merge-request
changes: *code-backstage-patterns
- <<: *if-merge-request-labels-as-if-jh
- <<: *if-merge-request-labels-run-all-rspec
- <<: *if-merge-request
changes: *startup-css-patterns
- <<: *if-merge-request
changes: *ci-patterns
.frontend:rules:jest: .frontend:rules:jest:
rules: rules:
- <<: *if-merge-request-labels-run-all-jest - <<: *if-merge-request-labels-run-all-jest
...@@ -552,6 +579,7 @@ ...@@ -552,6 +579,7 @@
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
# We already have `static-analysis as-if-foss` which already runs `lint:eslint:all` if the `pipeline:run-as-if-foss` label is set.
- <<: *if-merge-request-labels-as-if-foss - <<: *if-merge-request-labels-as-if-foss
when: never when: never
- <<: *if-merge-request - <<: *if-merge-request
...@@ -1565,6 +1593,15 @@ ...@@ -1565,6 +1593,15 @@
changes: *code-backstage-patterns changes: *code-backstage-patterns
when: on_success when: on_success
.setup:rules:add-jh-folder:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-labels-as-if-jh
- <<: *if-merge-request-labels-run-all-rspec
- changes: *code-backstage-qa-patterns
- changes: *startup-css-patterns
####################### #######################
# Test metadata rules # # Test metadata rules #
####################### #######################
......
...@@ -101,3 +101,19 @@ detect-tests as-if-foss: ...@@ -101,3 +101,19 @@ detect-tests as-if-foss:
MATCHED_TESTS_FILE: tmp/matching_foss_tests.txt MATCHED_TESTS_FILE: tmp/matching_foss_tests.txt
before_script: before_script:
- '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb' - '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb'
add-jh-folder:
extends: .setup:rules:add-jh-folder
image: ${GITLAB_DEPENDENCY_PROXY}alpine:edge
stage: prepare
before_script:
- apk add --no-cache --update curl bash
script:
- curl --location -o "jh-folder.tar.gz" "https://gitlab.com/gitlab-jh/gitlab/-/archive/main-jh/gitlab-main-jh.tar.gz?path=jh"
- tar -xf "jh-folder.tar.gz"
- mv gitlab-main-jh-jh/jh/ ./
- ls -l jh/
artifacts:
expire_in: 2d
paths:
- jh/
...@@ -7,6 +7,7 @@ module Tasks ...@@ -7,6 +7,7 @@ module Tasks
module Assets module Assets
FOSS_ASSET_FOLDERS = %w[app/assets fixtures/emojis vendor/assets/javascripts].freeze FOSS_ASSET_FOLDERS = %w[app/assets fixtures/emojis vendor/assets/javascripts].freeze
EE_ASSET_FOLDERS = %w[ee/app/assets].freeze EE_ASSET_FOLDERS = %w[ee/app/assets].freeze
JH_ASSET_FOLDERS = %w[jh/app/assets].freeze
JS_ASSET_PATTERNS = %w[*.js config/**/*.js].freeze JS_ASSET_PATTERNS = %w[*.js config/**/*.js].freeze
JS_ASSET_FILES = %w[package.json yarn.lock].freeze JS_ASSET_FILES = %w[package.json yarn.lock].freeze
MASTER_MD5_HASH_FILE = 'master-assets-hash.txt' MASTER_MD5_HASH_FILE = 'master-assets-hash.txt'
...@@ -28,6 +29,7 @@ module Tasks ...@@ -28,6 +29,7 @@ module Tasks
def self.assets_impacting_webpack_compilation def self.assets_impacting_webpack_compilation
assets_folders = FOSS_ASSET_FOLDERS assets_folders = FOSS_ASSET_FOLDERS
assets_folders += EE_ASSET_FOLDERS if ::Gitlab.ee? assets_folders += EE_ASSET_FOLDERS if ::Gitlab.ee?
assets_folders += JH_ASSET_FOLDERS if ::Gitlab.jh?
asset_files = Dir.glob(JS_ASSET_PATTERNS) asset_files = Dir.glob(JS_ASSET_PATTERNS)
asset_files += JS_ASSET_FILES asset_files += JS_ASSET_FILES
......
...@@ -120,7 +120,7 @@ function rspec_paralellized_job() { ...@@ -120,7 +120,7 @@ function rspec_paralellized_job() {
fi fi
if [[ "${test_tool}" =~ "-all" ]]; then if [[ "${test_tool}" =~ "-all" ]]; then
spec_folder_prefixes="['', 'ee/']" spec_folder_prefixes="['', 'ee/', 'jh/']"
fi fi
export KNAPSACK_LOG_LEVEL="debug" export KNAPSACK_LOG_LEVEL="debug"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment