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:
- .frontend:rules:compile-test-assets-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:
extends:
- compile-production-assets
......@@ -112,7 +118,7 @@ update-storybook-yarn-cache:
- .rails-cache
- .use-pg12
stage: fixtures
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets"]
needs: ["setup-test-env", "retrieve-tests-metadata"]
variables:
WEBPACK_VENDOR_DLL: "true"
script:
......@@ -128,19 +134,38 @@ update-storybook-yarn-cache:
- tmp/tests/frontend/
- knapsack/
# In gitlab-foss, generates FOSS fixtures. In gitlab, generates FOSS & EE fixtures.
# That way, we don't need to have two separate jobs.
# Builds FOSS, and EE fixtures in the EE project.
# Builds FOSS fixtures in the FOSS project.
rspec-all frontend_fixture:
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs
needs:
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets"
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:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs-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:
variables:
......@@ -168,7 +193,9 @@ graphql-schema-dump:
# Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true"
SETUP_DB: "false"
before_script:
- !reference [.default-before_script, before_script]
- *yarn-install
stage: test
......@@ -190,9 +217,7 @@ jest:
extends:
- .jest-base
- .frontend:rules:jest
needs:
- job: "detect-tests"
- job: "rspec-all frontend_fixture"
needs: ["rspec-all frontend_fixture"]
artifacts:
name: coverage-frontend
expire_in: 31d
......@@ -209,6 +234,9 @@ jest minimal:
extends:
- jest
- .frontend:rules:jest:minimal
needs:
- !reference [jest, needs]
- "detect-tests"
script:
- run_timed_command "yarn jest:ci:minimal"
......@@ -227,9 +255,17 @@ jest-as-if-foss:
- .jest-base
- .frontend:rules:default-frontend-jobs-as-if-foss
- .as-if-foss
needs: ["rspec frontend_fixture as-if-foss"]
needs: ["rspec-all frontend_fixture as-if-foss"]
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:
extends:
- .default-retry
......@@ -342,7 +378,7 @@ startup-css-check as-if-foss:
- .frontend:rules:default-frontend-jobs-as-if-foss
needs:
- 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:
extends:
......@@ -351,14 +387,15 @@ startup-css-check as-if-foss:
script:
- *storybook-yarn-install
- yarn run storybook:build
needs: ["graphql-schema-dump"]
compile-storybook:
extends:
- .compile-storybook-base
- .frontend:rules:default-frontend-jobs
needs:
- !reference [.compile-storybook-base, needs]
- job: "rspec-all frontend_fixture"
- job: "graphql-schema-dump"
artifacts:
name: storybook
expire_in: 31d
......@@ -372,5 +409,5 @@ compile-storybook as-if-foss:
- .as-if-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
needs:
- job: "graphql-schema-dump"
- job: "rspec frontend_fixture as-if-foss"
- !reference [.compile-storybook-base, needs]
- job: "rspec-all frontend_fixture as-if-foss"
......@@ -10,6 +10,7 @@
.default-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'
- export GOPATH=$CI_PROJECT_DIR/.go
- mkdir -p $GOPATH
......
......@@ -40,6 +40,9 @@
.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-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: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:update-cache/'
......@@ -491,8 +494,19 @@
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-labels-as-if-foss
- <<: *if-merge-request-labels-run-all-rspec
- 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
- changes: *code-backstage-qa-patterns
- changes: *startup-css-patterns
.frontend:rules:default-frontend-jobs:
rules:
......@@ -512,6 +526,19 @@
- <<: *if-merge-request
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:
rules:
- <<: *if-merge-request-labels-run-all-jest
......@@ -552,6 +579,7 @@
rules:
- <<: *if-not-ee
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
when: never
- <<: *if-merge-request
......@@ -1565,6 +1593,15 @@
changes: *code-backstage-patterns
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 #
#######################
......
......@@ -101,3 +101,19 @@ detect-tests as-if-foss:
MATCHED_TESTS_FILE: tmp/matching_foss_tests.txt
before_script:
- '[ "$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
module Assets
FOSS_ASSET_FOLDERS = %w[app/assets fixtures/emojis vendor/assets/javascripts].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_FILES = %w[package.json yarn.lock].freeze
MASTER_MD5_HASH_FILE = 'master-assets-hash.txt'
......@@ -28,6 +29,7 @@ module Tasks
def self.assets_impacting_webpack_compilation
assets_folders = FOSS_ASSET_FOLDERS
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 += JS_ASSET_FILES
......
......@@ -120,7 +120,7 @@ function rspec_paralellized_job() {
fi
if [[ "${test_tool}" =~ "-all" ]]; then
spec_folder_prefixes="['', 'ee/']"
spec_folder_prefixes="['', 'ee/', 'jh/']"
fi
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