Fix Flaky CI - Kill and Run #7953
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: [rest-server, worker, frontend] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
pip- | |
- run: pip install -r requirements.txt | |
- run: python3 codalab_service.py build --pull --version ${VERSION} -s ${SERVICE} $([ -z "${CODALAB_DOCKER_USERNAME}" ] || echo "--push") | |
env: | |
CODALAB_DOCKER_USERNAME: ${{ secrets.CODALAB_DOCKER_USERNAME }} | |
CODALAB_DOCKER_PASSWORD: ${{ secrets.CODALAB_DOCKER_PASSWORD }} | |
# Gives us the branch name of the PR if on a pull_request-triggered build, | |
# otherwise, "master" if on a push-triggered build | |
VERSION: ${{ github.head_ref || 'master' }} | |
SERVICE: ${{ matrix.service }} | |
test_backend: | |
name: Test backend | |
runs-on: ubuntu-latest | |
needs: [build] | |
strategy: | |
matrix: | |
test: | |
- {name: search read kill, index: 26} | |
- {name: search read kill, index: 27} | |
- {name: search read kill, index: 28} | |
- {name: search read kill, index: 29} | |
- {name: search read kill, index: 30} | |
- {name: search read kill, index: 31} | |
- {name: search read kill, index: 32} | |
- {name: search read kill, index: 33} | |
- {name: search read kill, index: 34} | |
- {name: search read kill, index: 35} | |
- {name: search read kill, index: 36} | |
- {name: search read kill, index: 37} | |
- {name: search read kill, index: 38} | |
runtime: [docker] | |
steps: | |
- name: Clear free space | |
run: | | |
sudo rm -rf /opt/ghc | |
df -h | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
pip- | |
- run: pip install -r requirements.txt | |
- name: Setup tests | |
run: | | |
sudo service mysql stop | |
python3 codalab_service.py build services --version ${VERSION} --pull | |
env: | |
VERSION: ${{ github.head_ref || 'master' }} | |
- name: Run tests using Docker runtime | |
if: matrix.runtime == 'docker' | |
run: | | |
sh ./tests/test-setup.sh | |
python3 codalab_service.py start --services default --version ${VERSION} | |
python3 test_runner.py --version ${VERSION} ${TEST} | |
env: | |
TEST: ${{ matrix.test.name }} | |
VERSION: ${{ github.head_ref || 'master' }} | |
CODALAB_LINK_MOUNTS: /tmp | |
- name: Save logs | |
if: always() | |
run: | | |
mkdir /tmp/logs | |
for c in $(docker ps -a --format="{{.Names}}"); do docker logs $c > /tmp/logs/$c.log 2> /tmp/logs/$c.err.log; done | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v1 | |
with: | |
name: logs-test-docker-${{ matrix.test.name }}-${{ matrix.test.index }} | |
path: /tmp/logs | |
test_backend_azure_blob: | |
name: Test backend with Azure Blob Storage | |
runs-on: ubuntu-latest | |
needs: [build] | |
strategy: | |
matrix: | |
test: | |
- {name: search read kill, index: 26} | |
- {name: search read kill, index: 27} | |
- {name: search read kill, index: 28} | |
- {name: search read kill, index: 29} | |
- {name: search read kill, index: 30} | |
- {name: search read kill, index: 31} | |
- {name: search read kill, index: 32} | |
- {name: search read kill, index: 33} | |
- {name: search read kill, index: 34} | |
- {name: search read kill, index: 35} | |
- {name: search read kill, index: 36} | |
- {name: search read kill, index: 37} | |
- {name: search read kill, index: 38} | |
steps: | |
- name: Clear free space | |
run: | | |
sudo rm -rf /opt/ghc | |
df -h | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
pip- | |
- run: pip install -r requirements.txt | |
- name: Setup tests | |
run: | | |
sudo service mysql stop | |
python3 codalab_service.py build services --version ${VERSION} --pull | |
env: | |
VERSION: ${{ github.head_ref || 'master' }} | |
- name: Run tests | |
run: | | |
python3 codalab_service.py start --services default azurite --version ${VERSION} | |
python3 test_runner.py --version ${VERSION} ${TEST} | |
env: | |
TEST: ${{ matrix.test.name }} | |
VERSION: ${{ github.head_ref || 'master' }} | |
CODALAB_LINK_MOUNTS: /tmp | |
CODALAB_ALWAYS_USE_AZURE_BLOB_BETA: 1 | |
- name: Save logs | |
if: always() | |
run: | | |
mkdir /tmp/logs | |
for c in $(docker ps -a --format="{{.Names}}"); do docker logs $c > /tmp/logs/$c.log 2> /tmp/logs/$c.err.log; done | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v1 | |
with: | |
name: logs-test-azblob-docker-${{ matrix.test.name }}-${{ matrix.test.index }} | |
path: /tmp/logs |