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

Add image compression to pull requests #8273

Open
mattstratton opened this issue Sep 14, 2019 · 6 comments
Open

Add image compression to pull requests #8273

mattstratton opened this issue Sep 14, 2019 · 6 comments

Comments

@mattstratton
Copy link
Member

Suggested by @mrbusche, we should add the image-actions GitHub action to automatically perform compression on images in PR's.

@mattstratton
Copy link
Member Author

This workflow seems to take a really long time to run (it's at >13m right now and it's not done yet in my first test).

It seems like with GitHub Actions we can set an action to run only on specific branches; maybe what we could do is create a naming standard and manually push PR's from that branch every now and again to optimize all the images, something like:

on:
  push:
    # Sequence of patterns matched against refs/heads
    branches:    
      - 'performance/*'   # Push events to branches matching refs/heads/performance/*

So for example, if I want to run an image optimization, I would run git checkout -b performance/matt-perf and then push that branch up and kick a PR. That would, in theory, only run the GH image optimization on that branch.

@mattstratton
Copy link
Member Author

Oh! You can run actions on a schedule:

https://help.github.com/en/articles/workflow-syntax-for-github-actions#onschedule

You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled workflows run on the latest commit on the default or base branch.

If we wanted it to run every day against master at 2am, it would look like this:

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '0 2 * * *'

I think the schedule is the best way to do it. Thoughts, @adrianmoisey and @bridgetkromhout ?

@mattstratton
Copy link
Member Author

(The full action takes 21 minutes to run, so it's not something we want to run on all PR's)

@mattstratton
Copy link
Member Author

Hmm. Doesn't look like it completes for us:

https://github.com/devopsdays/devopsdays-web/pull/8274/checks?check_run_id=222210418#step:4:7320

	 *  Head SHA: cdf0db10952ecef99e62678e452c9d6bd7dc014b
	 *  Tree 8a59b30c851ab4107af8c85f0d66fae9d2892257
	 *  Converting images to blobs…
(node:1) UnhandledPromiseRejectionWarning: HttpError: API rate limit exceeded for installation ID 1908306.
    at response.text.then.message (/usr/local/src/image-actions/node_modules/@octokit/request/lib/request.js:56:27)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@mattstratton
Copy link
Member Author

I logged an issue on calibreapp/image-actions about this :) calibreapp/image-actions#13

@mattstratton
Copy link
Member Author

Doesn't look like this issue on the actions side is going to be handled, so we might need a new solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants