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

Planet 5484 create zip on tag #1182

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 42 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ workflows:
context: org-global
- a11y-tests:
context: org-global
- rips-test:
context: rips-scans
- create-release-zip:
context: org-global
filters:
branches:
ignore: /.*/
Expand Down Expand Up @@ -86,7 +86,7 @@ job-references:

commands:
install-instance:
steps:
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
Expand Down Expand Up @@ -116,7 +116,7 @@ commands:
extract-command:
type: string
steps:
- run:
- run:
name: << parameters.test-name >>
command: << parameters.test-command >>
- run:
Expand Down Expand Up @@ -185,11 +185,44 @@ jobs:
errors=$(jq '.["results"] | .[] | unique_by(.["type"]) | map(select(.["type"] == "error")) | .[]' planet4-docker-compose/artifacts/pa11y/pa11y-ci-results.json)
if [ ! -z "${errors}" ]; then echo "Errors found, see report in artifacts." && exit 1; else echo "No errors, report available in artifacts."; fi

rips-test:
create-release-zip:
docker:
- image: rips/rips-cli:3
environment:
RIPS_APPLICATION_ID: 21
- image: mhart/alpine-node
steps:
- run: apk add curl zip git openssh-client jq python make g++
- checkout
- run: rips-cli -vvv rips:scan:start -a $RIPS_APPLICATION_ID -p ~/project/ -t 1
- run: git submodule init && git submodule update
- run: PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci
comzeradd marked this conversation as resolved.
Show resolved Hide resolved
- run: npm run build
- run:
name: "Remove files we don't want in the zip file."
command: rm -rf .circleci .git .githooks assets/src bin tests
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included the ones of which I was sure they wouldn't be needed in the zip. Maybe there's some others which would make sense to exclude here? The total zip size is currently about 1.8MB.

- run: mkdir -p /tmp/workspace/
# Exclude node_modules instead of removing, which takes a long time (lots of small files).
- run:
name: "Create zip file"
command: zip -r /tmp/workspace/planet4-master-theme.zip . -x "node_modules/*"
- run:
name: "Zip file size sanity check"
command: |
ls -lh /tmp/workspace/planet4-master-theme.zip
if [ $(wc -c </tmp/workspace/planet4-master-theme.zip) -ge 5000000 ]; then
echo "Zip file size exceeds 5MB, probably something went wrong."
exit 1
fi
- run:
name: "Get upload url for this tag"
command: |
curl https://api.github.com/repos/greenpeace/planet4-master-theme/releases/tags/${CIRCLE_TAG} |
jq -r .upload_url |
sed 's/{.*}/?name=planet4-master-theme.zip/' > /tmp/workspace/upload_url
cat /tmp/workspace/upload_url
- run:
name: "Upload zip file"
command: |
curl \
--fail \
-H "Authorization: token ${GITHUB_RELEASES_TOKEN}" \
-H "Content-Type: application/zip" \
--data-binary @/tmp/workspace/planet4-master-theme.zip \
"$(cat /tmp/workspace/upload_url)" | jq
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"vendor/plugins/{$name}/": ["type:wordpress-plugin"]
}
},
"require": {
"greenpeace/github-archive-installer": "^1.2"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5.3",
"wp-coding-standards/wpcs": "^2.2.0",
Expand Down