|
| 1 | +# This file is largely copied from the Zulip server's continuous |
| 2 | +# integration. The intent is to run the Zulip server's API |
| 3 | +# documentation test suite using the current version of this project, |
| 4 | +# to verify that the API client is generally compatible with the old |
| 5 | +# server release. |
| 6 | +name: Zulip server CI |
| 7 | + |
| 8 | +on: [push, pull_request] |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + |
| 14 | +jobs: |
| 15 | + tests: |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + # Base images are built using `tools/ci/Dockerfile.prod.template`. |
| 21 | + # The comments at the top explain how to build and upload these images. |
| 22 | + # Bionic ships with Python 3.6. |
| 23 | + - docker_image: zulip/ci:bionic |
| 24 | + name: Ubuntu 18.04 Bionic (Python 3.6, backend) |
| 25 | + os: bionic |
| 26 | + is_bionic: true |
| 27 | + include_frontend_tests: false |
| 28 | + # Configure this test to run with the Zulip 3.2 release. |
| 29 | + legacy_client_interface: 3 |
| 30 | + server_version: refs/tags/3.2 |
| 31 | + # Focal ships with Python 3.8.2. |
| 32 | + - docker_image: zulip/ci:focal |
| 33 | + name: Ubuntu 20.04 Focal (Python 3.8, backend) |
| 34 | + os: focal |
| 35 | + is_focal: true |
| 36 | + include_frontend_tests: false |
| 37 | + legacy_client_interface: 4 |
| 38 | + server_version: refs/tags/4.0 |
| 39 | + # Bullseye ships with Python 3.9.2. |
| 40 | + - docker_image: zulip/ci:bullseye |
| 41 | + name: Debian 11 Bullseye (Python 3.9, backend) |
| 42 | + os: bullseye |
| 43 | + is_bullseye: true |
| 44 | + include_frontend_tests: false |
| 45 | + legacy_client_interface: 4 |
| 46 | + server_version: refs/tags/4.0 |
| 47 | + |
| 48 | + runs-on: ubuntu-latest |
| 49 | + name: ${{ matrix.name }} (Zulip ${{matrix.server_version}}) |
| 50 | + container: ${{ matrix.docker_image }} |
| 51 | + env: |
| 52 | + # GitHub Actions sets HOME to /github/home which causes |
| 53 | + # problem later in provison and frontend test that runs |
| 54 | + # tools/setup/postgresql-init-dev-db because of the .pgpass |
| 55 | + # location. PostgreSQL (psql) expects .pgpass to be at |
| 56 | + # /home/github/.pgpass and setting home to `/home/github/` |
| 57 | + # ensures it written there because we write it to ~/.pgpass. |
| 58 | + HOME: /home/github/ |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Add required permissions |
| 62 | + run: | |
| 63 | + # The checkout actions doesn't clone to ~/zulip or allow |
| 64 | + # us to use the path option to clone outside the current |
| 65 | + # /__w/zulip/zulip directory. Since this directory is owned |
| 66 | + # by root we need to change it's ownership to allow the |
| 67 | + # github user to clone the code here. |
| 68 | + # Note: /__w/ is a docker volume mounted to $GITHUB_WORKSPACE |
| 69 | + # which is /home/runner/work/. |
| 70 | + sudo chown -R github . |
| 71 | +
|
| 72 | + # This is the GitHub Actions specific cache directory the |
| 73 | + # the current github user must be able to access for the |
| 74 | + # cache action to work. It is owned by root currently. |
| 75 | + sudo chmod -R 0777 /__w/_temp/ |
| 76 | +
|
| 77 | + - name: 'Checkout python-zulip-api' |
| 78 | + uses: actions/checkout@v2 |
| 79 | + with: |
| 80 | + path: api |
| 81 | + |
| 82 | + - name: 'Checkout Zulip server ${{ matrix.server_version }}' |
| 83 | + uses: actions/checkout@v2 |
| 84 | + with: |
| 85 | + repository: zulip/zulip |
| 86 | + ref: ${{ matrix.server_version }} |
| 87 | + path: server |
| 88 | + |
| 89 | + - name: Do Bionic hack |
| 90 | + if: ${{ matrix.is_bionic }} |
| 91 | + run: | |
| 92 | + # Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See |
| 93 | + # https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI |
| 94 | + sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf |
| 95 | +
|
| 96 | + - name: Install dependencies |
| 97 | + run: | |
| 98 | + cd server |
| 99 | + # This is the main setup job for the test suite |
| 100 | + ./tools/ci/setup-backend --skip-dev-db-build |
| 101 | +
|
| 102 | + # Cleaning caches is mostly unnecessary in GitHub Actions, because |
| 103 | + # most builds don't get to write to the cache. |
| 104 | + # scripts/lib/clean_unused_caches.py --verbose --threshold 0 |
| 105 | +
|
| 106 | + - name: Replace dependency with the latest python-zulip-api |
| 107 | + run: | |
| 108 | + cd server |
| 109 | + source tools/ci/activate-venv |
| 110 | + pip install ../api/zulip |
| 111 | + pip install ../api/zulip_bots |
| 112 | +
|
| 113 | + - name: Run documentation and api tests |
| 114 | + run: | |
| 115 | + cd server |
| 116 | + source tools/ci/activate-venv |
| 117 | + ./tools/test-api |
| 118 | + env: |
| 119 | + LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION: ${{ matrix.legacy_client_interface }} |
| 120 | + |
| 121 | + - name: Run backend tests |
| 122 | + run: | |
| 123 | + cd server |
| 124 | + source tools/ci/activate-venv |
| 125 | + ./tools/test-backend zerver.tests.test_bots zerver.tests.test_embedded_bot_system |
| 126 | + env: |
| 127 | + LEGACY_CLIENT_INTERFACE_FROM_SERVER_DOCS_VERSION: ${{ matrix.legacy_client_interface }} |
0 commit comments