Skip to content

Commit

Permalink
1154: Add circleci config check and create a more saving commit workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ztefanie committed Oct 12, 2023
1 parent b0791ae commit e2650c7
Show file tree
Hide file tree
Showing 8 changed files with 660 additions and 547 deletions.
1,144 changes: 597 additions & 547 deletions .circleci/config.yml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .circleci/src/@common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@ version: 2.1
orbs:
gradle: circleci/[email protected]
browser-tools: circleci/[email protected]

parameters:
run_commit:
default: false
type: boolean
run_backend:
default: false
type: boolean
run_frontend:
default: false
type: boolean
28 changes: 28 additions & 0 deletions .circleci/src/commands/check-circleci-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
description: This command builds the circle config from the files in src and validates that it is up-to-date and valid.
steps:
- run:
name: Install CircleCI CLI
command: curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash
- run:
name: Build circle config
command: ./scripts/circleci-update-config.sh
- run: # Taken from https://github.com/roopakv/orbs/blob/master/src/commands/fail_if_dirty.yml
name: CircleCI config up to date
# language=bash
command: |
FILES_MODIFIED=""
setcommit () {
FILES_MODIFIED=$(git status -s | grep -i -E '.*circleci/config.yml')
}
setcommit || true
if [ -z "$FILES_MODIFIED" ]
then
echo "The CircleCI config is up to date."
exit 0;
else
echo "The CircleCI config is not up to date. You can update it by running `yarn run circleci:update-config`."
exit 1;
fi
- run:
name: Validate circle config
command: circleci config validate
10 changes: 10 additions & 0 deletions .circleci/src/jobs/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docker:
- image: cimg/node:19.1.0-browsers
resource_class: small
environment:
TOTAL_CPUS: 1 # For resource_class small
TZ: 'Europe/Berlin' # Should be removed in IGAPP-39
shell: /bin/bash -eo pipefail
steps:
- checkout
- check-circleci-config
1 change: 1 addition & 0 deletions .circleci/src/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
when: << pipeline.parameters.run_backend >>
jobs:
- backend-build
- administration-build
Expand Down
11 changes: 11 additions & 0 deletions .circleci/src/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
when: << pipeline.parameters.run_commit >>
jobs:
- check
- backend-build
- backend-pack:
requires:
- backend-build
- backend-health-check:
requires:
- backend-pack
- check-frontend
1 change: 1 addition & 0 deletions .circleci/src/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
when: << pipeline.parameters.run_frontend >>
jobs:
- check-frontend
- frontend-android-build:
Expand Down
1 change: 1 addition & 0 deletions scripts/circleci-update-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ cat .circleci/autogenerated_header.yml; circleci config pack .circleci/src; } > .circleci/config.yml && circleci config validate

0 comments on commit e2650c7

Please sign in to comment.