Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: updates config to latest orb and new deployignore targets #5

Merged
merged 3 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 25 additions & 84 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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$/
24 changes: 24 additions & 0 deletions .deployignore
Original file line number Diff line number Diff line change
@@ -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