From 1b06ead6d2f2f04ab6612ff67c66ffd600f32430 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 22 Aug 2021 16:17:31 -0500 Subject: [PATCH 1/2] GitLab CI: only run jobs when relevant files change --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3505350917..1daf9a1529 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,14 +22,33 @@ before_script: lint-js: stage: lint script: yarn test:lint:js + only: + changes: + - "**/*.js" + - ".eslintignore" + - ".eslintrc.js" lint-sass: stage: lint script: yarn test:lint:sass + only: + changes: + - "**/*.scss" + - "**/*.css" + - ".stylelintrc.json" jest: stage: test script: yarn test:jest + only: + changes: + - "**/*.js" + - "**/*.json" + - "app/soapbox/**/*" + - "webpack/**/*" + - "jest.config.js" + - "package.json" + - "yarn.lock" build-production: stage: build @@ -39,6 +58,9 @@ build-production: artifacts: paths: - static + only: + changes: + - "!docs/**/*" docs-deploy: stage: deploy @@ -48,7 +70,10 @@ docs-deploy: script: - curl -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' https://gitlab.com/api/v4/projects/15685485/trigger/pipeline only: - - develop + refs: + - develop + changes: + - "docs/**/*" # Supposed to fail when translations are outdated, instead always passes # @@ -73,4 +98,7 @@ pages: paths: - public only: - - develop + refs: + - develop + changes: + - "!docs/**/*" From 4c183b3a84940be496bc477d029597f0b8ffb85f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 22 Aug 2021 16:32:26 -0500 Subject: [PATCH 2/2] GitLab CI: cache build directory between jobs --- .gitlab-ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1daf9a1529..57ac09f54f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,11 +4,14 @@ variables: NODE_ENV: test cache: - key: - files: - - yarn.lock - paths: - - node_modules + - key: + files: + - yarn.lock + paths: + - node_modules + - key: $CI_COMMIT_REF_NAME + paths: + - static stages: - lint @@ -88,8 +91,8 @@ docs-deploy: pages: stage: deploy + before_script: [] script: - - yarn build - mv static public - cp public/{index.html,404.html} variables: