Commit Graph

25 Commits

Author SHA1 Message Date
Riken Shah 4f54e15993 refactor: Convert `clean-unused-caches` to`clean_unused_caches.py`.
We convert the `clean-unused-caches` script to a
python file so we can run it in provision by importing it
instead of running the script, hence saving some time.
2021-06-12 07:28:16 -07:00
Anders Kaseorg 405bc8dabf requirements: Remove Thumbor.
Thumbor and tc-aws have been dragging their feet on Python 3 support
for years, and even the alphas and unofficial forks we’ve been running
don’t seem to be maintained anymore.  Depending on these projects is
no longer viable for us.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-06 20:07:32 -07:00
Adam Birds e27268837b tools: Have `optimize-svg` do the optimization automatiically.
I have made `tools/setup/optimize-svg` do the SVG optimization
automatically rather than just telling you the command to run if they
need optimizing. This included adding a `--check` parameter to use in
CI to only check as we previously did rather than actually running the
optimization.

I have also made `tools/setup/optimize-svg` execute
`tools/setup/generate_integration_bots_avatars.py` once it has run the
optimization to ensure it is always ran.

This makes it one less command to run when creating an integration,
but also means that we catch instances where a PNG has just been
copied into the `static/images/integrations/bot_avatars` folder as the
only instance where this won't be run is if `optimize-svg` has not
been run which would be caught in CI.

Fixes #18183. Fixes #18184.
2021-04-19 10:16:54 -07:00
Gaurav Pandey 1bdcb11543 ci: Run zulip backend test suite for Debian bullseye.
This also verifies the Zulip codebase's Python 3.9 support.
2021-04-15 21:38:31 -07:00
Alex Vandiver 0023d561dd ci: Switch to hosting the CI images under Zulip on Dockerhub. 2021-03-31 16:54:34 -07:00
Anders Kaseorg 056b715765 ci: Remove 2>&1 redirection.
We had used 2>&1 to redirect stderr to stdout so it could be piped
into ts, but commit dd3cdd6ec5 (#17611)
removed ts, so we no longer need the redirection.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 14:52:06 -07:00
Aman Agrawal 9c4d9dbaf1 ci: Regenerate bionic and focal containers.
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See https://github.com/sudo-project/sudo/issues/42.
We used these directories to restore caches.
Upgrading the focal dependencies via this commit naturally fixes that
bug.

Fixes #17854
2021-03-29 12:26:56 +05:30
Aman Agrawal e0ed9cc605 ci: Remove CircleCI workaround for buggy CPU count allocation.
GitHub Actions gives us 2 cpus (probably shared) to run the
jobs. Specifying 6 processes here doesn't make a difference
since both jobs run in around 5 minutes right now.
2021-03-16 15:11:26 -07:00
Aman Agrawal f2a137f863 github_actions: Remove Codecov workaround.
Codecov has released the new version which fixes the find error.
Followup from 6a357ea114
2021-03-16 15:11:21 -07:00
Aman Agrawal 76c69b943c github_actions: Explode backend and frontend tests.
We basically move all the tests from backend and frontend test
files to zulip-ci workflow. This results in GitHub Actions
nicely displaying all the tests separately.
2021-03-16 15:11:21 -07:00
Aman Agrawal dd3cdd6ec5 github_actions: Stop logging timestamp.
Timestamps are logged automatically by GitHub Actions and can be
made visible using log settings easily. Hence we remove the
unnecessary timestamps here to make the logs look much cleaner.
2021-03-16 15:11:21 -07:00
Alex Vandiver 2dc0662a50 ci: Upload puppeteer artifacts on failure.
Storing the puppeteer artifacts is useful for debugging failures in
CI.

Confusingly, `if: ${{ something }}` does not work out to be true like
`if: ${{ always() && something }}` does; the former has a silent
`success()` built into it[1]:

> If your if expression does not contain any of the status functions
> it will automatically result with success().

[1] https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions
2021-03-10 12:00:47 -08:00
Aman Agrawal 80268c52df ci: Notify in zulip when a build fails in GitHub Actions.
We use the circleci integration which already has a nice setup
for sending messages when triggered to send the build failure
notification.
2021-02-26 08:29:56 -08:00
Tim Abbott b6ec66e972 github: Enable retention periods for uploaded artifacts.
This prevents Zulip CI from eventually consuming large amounts of
storage on one's GitHub account.

I picked a longer retention period for the Puppeteer artifacts because
humans look at those; the production tarballs are unlikely to be used
10 minutes after the run completes as they are just for the next stage
fo the build; certainly 14 days seems ample for any debugging.
2020-11-03 16:36:26 -08:00
Alex Vandiver 2b0bbbb882 tools: Rename postgres to postgresql in tool names. 2020-10-28 11:57:02 -07:00
Anders Kaseorg 72d6ff3c3b docs: Fix more capitalization issues.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-23 11:46:55 -07:00
Tim Abbott f3921e57be ci: Remove confused references to test-event-log.
The "event log" in question was never useful in our test systems (and
hasn't been used for anything real since 2014).  I'm not sure how we
ended up with in the CI configuration.
2020-07-24 12:42:08 -07:00
Priyank Patel 98d1c215de github-actions: Rename focal and bionic tests job name to unit_tests. 2020-07-24 10:39:19 -07:00
Priyank Patel 4c475ab2f7 github-actions: Do not fail other jobs when one job in matrix fails.
This change makes it so if focal backend job fails the bionic
backend and frontend jobs keeps running. Previously, it failed both
of the jobs if one failed. This is expected since typically matrix
is used to run sames tests on multiple versions and such but our use
case is bit more than that.
2020-07-24 10:36:55 -07:00
Priyank Patel 711943a3ab github-actions: Use include_frontend_test check.
Uses the include_frontend_test instead of platfrom specific check.
2020-07-07 17:26:16 -07:00
Priyank Patel 29dd0c485a ci: Move upgrading git for bionic to docker image.
Just reduces the clutter in configuration file for GitHub Actions.
2020-07-06 18:09:15 -07:00
Priyank Patel c908278237 ci: Install moreutils in the docker image. 2020-07-06 18:09:15 -07:00
Priyank Patel 650ec29859 github-actions: Use stratergy and if to deduplicate steps.
This is a fine solution short-term until github implements the
yaml anchors support. The limitation of this method is that we
cannot re-use most of the steps again for production install test
builds.

Thanks, Anders for this solution.

Verifying everything is migrated correctly is a pain. This script
ensures everything is done correctly (previous commit message
contains explainations for the steps being ignored if; in case
of github-actions steps they are ignored because they are actions
specific):
"""
This script prints out the ignore steps first. Then
prints out each step of both circle and actions side-by-side.
One step is out of order for bionic but verfying correction is
still easier. Format:
Actions: Install dependencies
Circle CI: install dependencies
....
"""
import yaml

with open('.circleci/config.yml') as f:
    circleci_config = yaml.safe_load(f)

with open('.github/workflows/zulip-ci.yml') as f:
    actions_config = yaml.safe_load(f)

circle_bionic_steps = []
circle_focal_steps = []
actions_bionic_steps = []
actions_focal_steps = []

"""
We ignore casper artifact upload, save_cache, and
store_tests_reports steps.
"""
def get_circleci_steps(job, arr):
    for step in circleci_config['jobs'][job]['steps']:
        if isinstance(step, str):
            arr.append(step)
            continue

        step_name = step.get('run', {}).get('name', False)
        if not step_name:
            if step.get('restore_cache'):
                key = step['restore_cache']['keys'][0].split('.')[0]
                step_name = f'<restore-cache> {key}'
            elif step.get('store_artifacts', False):
                destination = step['store_artifacts']['destination']
                step_name = f'<store-artificats> {destination}'

                if destination == 'casper':
                    \# This is no longer needed
                    print('Ignoring step:')
                    print(step)
                    print()
                    continue
            else:
		"""
                We don't care about save_cache; github-actions
                does this automatically, and store_tests_reports
                is circelci timing specific.
		"""
                print('Ignoring step:')
                print(step)
                print()
                continue

        if step_name != 'On fail':
            arr.append(step_name)

get_circleci_steps('bionic-backend-frontend', circle_bionic_steps)
get_circleci_steps('focal-backend', circle_focal_steps)

""" We ignore there steps specific to github-actions"""
for step in actions_config['jobs']['focal_bionic']['steps']:
    BOTH_OS = 'BOTH_OS'
    if_check = step.get('if', BOTH_OS)
    step_name = step.get('name')

    if step_name is None:
        step_name = step['uses']

    if (
        step_name == 'Upgrade git for bionic' or
        step_name == 'Add required permissions' or
        step_name == 'Move test reports to var'
    ):
        print('Ignoring step:')
        print(step)
        print()
        """These are github-actions specific; see comments"""
        continue

    if if_check == BOTH_OS:
        actions_bionic_steps.append(step_name)
        actions_focal_steps.append(step_name)
    elif 'is_bionic' in if_check:
        actions_bionic_steps.append(step_name)
    else:
        actions_focal_steps.append(step_name)

bionic = zip(circle_bionic_steps, actions_bionic_steps)
focal = zip(circle_focal_steps, actions_focal_steps)

print('Bionic steps:')
for (circle_step, actions_step) in bionic:
    print(f'CircleCI: {circle_step}')
    print(f'Actions: {actions_step}')
    print()

print('Focal steps:')
for (circle_step, actions_step) in focal:
    print(f'CircleCI: {circle_step}')
    print(f'Actions: {actions_step}')
    print()
2020-07-06 18:09:15 -07:00
Priyank Patel ad5eb68ee1 github-actions: Add focal backend job.
No new sets of change in this commit that are explained two commits
before this one, which add bionic-backend-frontend.
2020-07-06 18:09:15 -07:00
Priyank Patel 7ff1fd5923 github-actions: Add bionic frontend and backend test job.
Some noteable diffrence from circleci:
   - We upgrade git to newer version (reason explained in comments)
   - We set HOME to /home/github (also explained in comments)
   - Adjust permissions (... comments)
   - Minor changes to step names and cache keys.
   - We don't need to port the save_cache steps they are done
     automatically in actions. And, we did not port the
     store_test_results step which is circleci specific.
   - We didn't port the notify_failure step yet (see the TODO).
2020-07-06 18:09:15 -07:00