mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
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.
173 lines
6.9 KiB
YAML
173 lines
6.9 KiB
YAML
name: Zulip CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
focal_bionic:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# This docker image was created by a generated Dockerfile at:
|
|
# tools/ci/images/bionic/Dockerfile
|
|
# Bionic ships with Python 3.6.
|
|
- docker_image: mepriyank/actions:bionic
|
|
name: Ubuntu 18.04 Bionic (Python 3.6, backend + frontend)
|
|
os: bionic
|
|
is_bionic: true
|
|
include_frontend_tests: true
|
|
|
|
# This docker image was created by a generated Dockerfile at:
|
|
# tools/ci/images/focal/Dockerfile
|
|
# Focal ships with Python 3.8.2.
|
|
- docker_image: mepriyank/actions:focal
|
|
name: Ubuntu 20.04 Focal (Python 3.8, backend)
|
|
os: focal
|
|
is_focal: true
|
|
include_frontend_tests: false
|
|
|
|
runs-on: ubuntu-latest
|
|
name: ${{ matrix.name }}
|
|
container: ${{ matrix.docker_image }}
|
|
env:
|
|
# GitHub Actions sets HOME to /github/home which causes
|
|
# problem later in provison and frontend test that runs
|
|
# tools/setup/postgres-init-dev-db because of the .pgpass
|
|
# location. Postgresql (psql) expects .pgpass to be at
|
|
# /home/github/.pgpass and setting home to `/home/github/`
|
|
# ensures it written there because we write it to ~/.pgpass.
|
|
HOME: /home/github/
|
|
|
|
steps:
|
|
- name: Add required permissions
|
|
run: |
|
|
# The checkout actions doesn't clone to ~/zulip or allow
|
|
# us to use the path option to clone outside the current
|
|
# /__w/zulip/zulip directory. Since this directory is owned
|
|
# by root we need to change it's ownership to allow the
|
|
# github user to clone the code here.
|
|
# Note: /__w/ is a docker volume mounted to $GITHUB_WORKSPACE
|
|
# which is /home/runner/work/.
|
|
sudo chown -R github .
|
|
|
|
# This is the GitHub Actions specific cache directory the
|
|
# the current github user must be able to access for the
|
|
# cache action to work. It is owned by root currently.
|
|
sudo chmod -R 0777 /__w/_temp/
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Create cache directories
|
|
run: |
|
|
dirs=(/srv/zulip-{npm,venv,emoji}-cache)
|
|
sudo mkdir -p "${dirs[@]}"
|
|
sudo chown -R github "${dirs[@]}"
|
|
|
|
- name: Restore node_modules cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /srv/zulip-npm-cache
|
|
key: v1-yarn-deps-${{ matrix.os }}-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}
|
|
restore-keys: v1-yarn-deps-${{ matrix.os }}
|
|
|
|
- name: Restore python cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /srv/zulip-venv-cache
|
|
key: v1-venv-${{ matrix.os }}-${{ hashFiles('requirements/thumbor-dev.txt') }}-${{ hashFiles('requirements/dev.txt') }}
|
|
restore-keys: v1-venv-${{ matrix.os }}
|
|
|
|
- name: Restore emoji cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /srv/zulip-emoji-cache
|
|
key: v1-emoji-${{ matrix.os }}-${{ hashFiles('tools/setup/emoji/emoji_map.json') }}-${{ hashFiles('tools/setup/emoji/build_emoji') }}-${{ hashFiles('tools/setup/emoji/emoji_setup_utils.py') }}-${{ hashFiles('tools/setup/emoji/emoji_names.py') }}-${{ hashFiles('package.json') }}
|
|
restore-keys: v1-emoji-${{ matrix.os }}
|
|
|
|
- name: Do Bionic hack
|
|
if: ${{ matrix.is_bionic }}
|
|
run: |
|
|
# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See
|
|
# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI
|
|
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
# This is the main setup job for the test suite
|
|
mispipe "tools/ci/setup-backend --skip-dev-db-build" ts
|
|
|
|
# Cleaning caches is mostly unnecessary in GitHub Actions, because
|
|
# most builds don't get to write to the cache.
|
|
# mispipe "scripts/lib/clean-unused-caches --verbose --threshold 0 2>&1" ts
|
|
|
|
- name: Run backend tests
|
|
run: |
|
|
. /srv/zulip-py3-venv/bin/activate && \
|
|
mispipe "./tools/ci/backend 2>&1" ts
|
|
|
|
- name: Run frontend tests
|
|
if: ${{ matrix.include_frontend_tests }}
|
|
run: |
|
|
. /srv/zulip-py3-venv/bin/activate
|
|
mispipe "./tools/ci/frontend 2>&1" ts
|
|
|
|
- name: Test locked requirements
|
|
if: ${{ matrix.is_bionic }}
|
|
run: |
|
|
. /srv/zulip-py3-venv/bin/activate && \
|
|
mispipe "./tools/test-locked-requirements 2>&1" ts
|
|
|
|
- name: Upload coverage reports
|
|
|
|
# Only upload coverage when both frontend and backend
|
|
# tests are ran.
|
|
if: ${{ matrix.include_frontend_tests }}
|
|
run: |
|
|
# Codcov requires `.coverage` file to be stored in the
|
|
# current working directory.
|
|
mv ./var/.coverage ./.coverage
|
|
. /srv/zulip-py3-venv/bin/activate || true
|
|
|
|
# TODO: Check that the next release of codecov doesn't
|
|
# throw find error.
|
|
# codecov==2.0.16 introduced a bug which uses "find"
|
|
# for locating files which is buggy on some platforms.
|
|
# It was fixed via https://github.com/codecov/codecov-python/pull/217
|
|
# and should get automatically fixed here once it's released.
|
|
# We cannot pin the version here because we need the latest version for uploading files.
|
|
# see https://community.codecov.io/t/http-400-while-uploading-to-s3-with-python-codecov-from-travis/1428/7
|
|
pip install codecov && codecov || echo "Error in uploading coverage reports to codecov.io."
|
|
|
|
- name: Store puppeteer artifacts
|
|
if: ${{ matrix.include_frontend_tests }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: puppeteer
|
|
path: ./var/puppeteer
|
|
|
|
# We cannot use upload-artifacts actions to upload the test
|
|
# reports from /tmp, that directory exists inside the docker
|
|
# image. Move them to ./var so we access it outside docker since
|
|
# the current directory is volume mounted outside the docker image.
|
|
- name: Move test reports to var
|
|
run: mv /tmp/zulip-test-event-log/ ./var/
|
|
|
|
- name: Store test reports
|
|
if: ${{ matrix.is_bionic }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: test-reports
|
|
path: ./var/zulip-test-event-log/
|
|
|
|
- name: Check development database build
|
|
if: ${{ matrix.is_focal }}
|
|
run: mispipe "tools/ci/setup-backend" ts
|
|
# TODO: We need to port the notify_failure step from CircleCI
|
|
# config, however, it might be the case that GitHub Notifications
|
|
# make this unnesscary. More details on settings to configure it:
|
|
# https://help.github.com/en/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-actions-notification-options
|