Skip to content

Commit

Permalink
!wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpenrath committed Dec 12, 2023
1 parent 8712cd9 commit acf0903
Showing 1 changed file with 64 additions and 77 deletions.
141 changes: 64 additions & 77 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,24 @@ parameters:
nightly-round:
type: boolean
default: false
aliases:
- &checkout_fun
checkout:
path: ~/fun

- &restore_node_modules
restore_cache:
name: Restore node_modules cache
keys:
- v8-front-dependencies-{{ checksum "~/fun/src/frontend/yarn.lock" }}
- v8-front-dependencies-

- &install-libcairo2-dev
run:
name: Install cairo package (required by easy_thumbnails[svg])
command: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev
commands:
skip_unchanged:
parameters:
Expand All @@ -34,51 +51,30 @@ commands:
type: string
description: Skip if no changes to "<< parameters.paths >>"
steps:
- *checkout_fun
- run:
name: Skip job when not modifying this folder
name: Check if job should be skipped
# Skip job when there is no diff in the paths
# except when the branch is the base one or the job is run on a tag
command: |
echo "Skip debugging"
echo "--------------"
GIT_BASE_BRANCH=<<parameters.git_base_branch>>
PATHS=<<parameters.paths>>
EXCEPT_BRANCHES=<<parameters.except_branches>>
echo "GIT_BASE_BRANCH=$GIT_BASE_BRANCH"
echo "PATHS=$PATHS"
echo "EXCEPT_BRANCHES=$EXCEPT_BRANCHES"
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
echo "BRANCH_NAME=$BRANCH_NAME"
IFS=' ' read -ra paths_arr \<<< "$PATHS"
echo "paths_arr=" "${paths_arr[@]}"
CHANGED_FILES="$(git diff "$GIT_BASE_BRANCH"..."$(git symbolic-ref --short -q HEAD)" --name-only --diff-filter=ACMRT "${paths_arr[@]}")";
CHANGED_FILES="$(git diff "$GIT_BASE_BRANCH"..."$CIRCLE_BRANCH" --name-only --diff-filter=ACMRT "${paths_arr[@]}")";
echo "CHANGED_FILES=$CHANGED_FILES"
if [[ "$EXCEPT_BRANCHES" == *"${BRANCH_NAME}"* ]] || [ -n "${CHANGED_FILES}" ];
if [[ -n "${CIRCLE_TAG}" ]] || [[ "$EXCEPT_BRANCHES" == *"${CIRCLE_BRANCH}"* ]] || [ -n "${CHANGED_FILES}" ];
then
exit 0;
fi
circleci step halt;
aliases:
- &checkout_fun
checkout:
path: ~/fun

- &restore_node_modules
restore_cache:
name: Restore node_modules cache
keys:
- v8-front-dependencies-{{ checksum "~/fun/src/frontend/yarn.lock" }}
- v8-front-dependencies-

- &install-libcairo2-dev
run:
name: Install cairo package (required by easy_thumbnails[svg])
command: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev
jobs:
# Git jobs
# Check that the git history is clean and complies with our expectations
Expand Down Expand Up @@ -231,9 +227,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand All @@ -255,9 +248,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun/src/richie
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand All @@ -283,9 +273,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand Down Expand Up @@ -316,8 +303,6 @@ jobs:
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- attach_workspace:
at: ~/fun
- run:
Expand Down Expand Up @@ -379,9 +364,6 @@ jobs:
REDIS_MASTER_HOST: redis-primary
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand Down Expand Up @@ -474,9 +456,6 @@ jobs:
REDIS_MASTER_HOST: redis-primary
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand Down Expand Up @@ -563,9 +542,6 @@ jobs:
REDIS_MASTER_HOST: redis-primary
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand Down Expand Up @@ -646,9 +622,6 @@ jobs:
REDIS_MASTER_HOST: redis-primary
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
- restore_cache:
keys:
- v2-back-dependencies-{{ .Revision }}
Expand Down Expand Up @@ -690,8 +663,6 @@ jobs:
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
# Ensure we restore frontend production builds in Richie's static
# directory
- attach_workspace:
Expand Down Expand Up @@ -721,8 +692,6 @@ jobs:
working_directory: ~/fun
steps:
- checkout
- skip_unchanged:
paths: ~/fun/src/richie
# Restore built python packages
- attach_workspace:
at: ~/fun
Expand All @@ -745,9 +714,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun/src/frontend
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/frontend
- *restore_node_modules
# If the yarn.lock file is not up-to-date with the package.json file,
# using the --frozen-lockfile should fail.
Expand Down Expand Up @@ -780,9 +746,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun/src/frontend
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/frontend
- *restore_node_modules
- run:
name: Build front-end application in production mode
Expand All @@ -809,11 +772,8 @@ jobs:
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
working_directory: ~/fun-site-factory/frontend
working_directory: ~/fun/frontend
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun-site-factory/frontend
- *restore_node_modules
- run:
name: Initialize a frontend project that uses richie-education module
Expand Down Expand Up @@ -923,9 +883,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun/src/frontend
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/frontend
- *restore_node_modules
- run:
name: Lint code with eslint
Expand All @@ -944,9 +901,6 @@ jobs:
resource_class: large
working_directory: ~/fun/src/frontend
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/frontend
- *restore_node_modules
- run:
name: Run tests
Expand All @@ -958,11 +912,8 @@ jobs:
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
working_directory: ~/wrk
working_directory: ~/fun
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/wrk
- run:
name: Check SCSS library
command: |
Expand All @@ -985,9 +936,6 @@ jobs:
password: $DOCKER_PASS
working_directory: ~/fun
steps:
- *checkout_fun
- skip_unchanged:
paths: ~/fun/src/frontend
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/fun/.npmrc
Expand Down Expand Up @@ -1045,34 +993,52 @@ workflows:
#
# Build, lint and test the front-end apps
- build-front:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
filters:
tags:
only: /.*/
- build-front-production:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
requires:
- build-front
filters:
tags:
only: /.*/
- build-dependent-front:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
requires:
- build-front
filters:
tags:
only: /.*/
- lint-front:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
requires:
- build-front
filters:
tags:
only: /.*/
- test-front:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
requires:
- lint-front
filters:
tags:
only: /.*/
- test-front-package:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/frontend
requires:
- lint-front
filters:
Expand Down Expand Up @@ -1124,37 +1090,55 @@ workflows:
# Build, lint and test production and development Docker images
# (debian-based)
- build-back:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
filters:
tags:
only: /.*/
- lint-back:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
filters:
tags:
only: /.*/
- test-back-mysql-5:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
- build-front-production
filters:
tags:
only: /.*/
- test-back-mysql-8:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
- build-front-production
filters:
tags:
only: /.*/
- test-back-postgresql:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
- build-front-production
filters:
tags:
only: /.*/
- test-back-postgresql-es6:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
- build-front-production
Expand All @@ -1166,6 +1150,9 @@ workflows:
#
# Extract strings and upload them to our translation management SaaS
- build-back-i18n:
pre-steps:
- skip_unchanged:
paths: ~/fun/src/richie
requires:
- build-back
filters:
Expand Down

0 comments on commit acf0903

Please sign in to comment.