From e3b1d3281b95a2cbbf0541e05ea5e5c8f3510a7b Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 23 Jun 2023 15:06:31 +0100 Subject: [PATCH 1/2] ci: updates config to latest orb and new deployignore targets --- .circleci/config.yml | 109 ++++++++++--------------------------------- .deployignore | 24 ++++++++++ 2 files changed, 49 insertions(+), 84 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ed396d..2720e4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,88 +1,29 @@ version: 2.1 +orbs: + project: bigbite/project@0.0.64 + jobs: - build: - docker: - - image: cimg/php:8.0.13-node - steps: - - add_ssh_keys - - checkout - - run: - when: always - name: Install SSH Key - command: | - rm ~/.ssh/id_rsa && rm ~/.ssh/id_rsa.pub - touch ~/.ssh/id_rsa_tmp - echo "${BIGBITE_CI_GH_SSH_KEY}" > ~/.ssh/id_rsa_tmp - awk '{gsub(/\\n/,"\n")}1' ~/.ssh/id_rsa_tmp > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - echo -e "Host github.com\n\tIdentityFile ~/.ssh/id_rsa\n\tIdentitiesOnly yes\n" > ~/.ssh/config - - run: sudo composer self-update --1 - - run: - when: always - name: Setup Composer Auth - command: | - COMPOSER_PATH=$(composer config home --global) - touch $COMPOSER_PATH/auth.json - printf '{ "github-oauth": { "github.com": "%s" } }' ${BIGBITE_CI_GH_TOKEN} > $COMPOSER_PATH/auth.json - - restore_cache: - keys: - - composer-deps-{{ .Branch }}-{{ checksum "composer.lock" }} - - run: composer install - - save_cache: - key: composer-deps-{{ .Branch }}-{{ checksum "composer.lock" }} - paths: - - vendor - - restore_cache: - keys: - - npm-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} - - run: npm ci - - run: npm run build:prod - - save_cache: - key: npm-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} - paths: - - ~/usr/local/lib/node_modules - - node_modules - - ~/.npm - - ~/.node-gyp - - run: - when: on_success - name: Check branch - command: | - # if [[ "$CIRCLE_PULL_REQUEST" != "false" ]]; then circleci step halt; fi - if [[ ! "$CIRCLE_BRANCH" =~ (main|master|develop|release/[0-9.]+|chore/update-ci) ]]; then circleci step halt; fi - - run: - when: on_success - name: Set Git - command: | - git config --global user.email "${BIGBITE_CI_EMAIL}" - git config --global user.name "${BIGBITE_CI_NAME}" - - run: - when: on_success - name: Clean Files - command: | - rm -rf node_modules - FILE=.deployignore - if [ -f "$FILE" ]; then - rm .gitignore - mv .deployignore .gitignore - fi - - run: - when: on_success - name: Built Branch - command: | - BRANCH_NAME=${CIRCLE_BRANCH} - git config --global user.email "${BIGBITE_CI_EMAIL}" - git config --global user.name "${BIGBITE_CI_NAME}" - git remote set-url origin https://${BIGBITE_CI_NAME}:${BIGBITE_CI_GH_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git - git checkout -b $BRANCH_NAME-built - git add -A && git commit -m "built from ${CIRCLE_SHA1}" - git push --force -u origin $BRANCH_NAME-built + build: + executor: + name: project/default + php: '8.0' + steps: + - checkout + - project/setup + - project/composer-install + - project/phpcs + - project/set-node: + version: '16' + - project/npm-install + - project/npm-build + - project/create-build + workflows: - workflow: - jobs: - - build: - context: bigbite - filters: - branches: - ignore: /^.*-built$/ + workflow: + jobs: + - build: + context: bigbite + filters: + branches: + ignore: /^.*-built$/ diff --git a/.deployignore b/.deployignore index e69de29..268dfef 100644 --- a/.deployignore +++ b/.deployignore @@ -0,0 +1,24 @@ +# npm + +node_modules +package-lock.json +package.json + +# composer + +composer.lock +vendor/bin +vendor/dealerdirect +vendor/squizlabs +vendor/wp-coding-standards + +# build + +src + +# other + +.gitignore +.circleci +.phpcs.xml.dist +phpstan.neon \ No newline at end of file From c11258e73a15c96f2775b3a2b75f99fc6194b54c Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 23 Jun 2023 16:41:09 +0100 Subject: [PATCH 2/2] build: adds linting check before any attempt to build --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf1d13e..68c1c02 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "prettier": "@wordpress/prettier-config", "scripts": { "watch:dev": "wp-scripts start", - "build:prod": "wp-scripts build" + "build:prod": "wp-scripts lint-js ./src && wp-scripts build" }, "dependencies": { "@wordpress/block-editor": "^11.8.0",