Skip to content

Commit

Permalink
ci: update github action to use services (#296)
Browse files Browse the repository at this point in the history
* ci: update github action to use services

* Update actions.yml

---------

Co-authored-by: Konstantin Lebedev <[email protected]>
  • Loading branch information
aronbierbaum and xzkostyan authored Aug 6, 2024
1 parent 0936a7e commit 523559e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 41 deletions.
39 changes: 16 additions & 23 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on: [push, pull_request]
name: build
jobs:
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
Expand All @@ -12,12 +12,21 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
clickhouse-version:
- 24.1.8.22
- 23.8.4.69
- 22.5.1.2079
- 19.3.5
- 18.14.9
include:
- clickhouse-version: 18.14.9
clickhouse-org: yandex
- clickhouse-version: 19.3.5
clickhouse-org: yandex
- clickhouse-version: 22.5.1.2079
clickhouse-org: clickhouse
- clickhouse-version: 23.8.4.69
clickhouse-org: clickhouse
services:
clickhouse-server:
image: ${{ matrix.clickhouse-org }}/clickhouse-server:${{ matrix.clickhouse-version }}
ports:
- 8123:8123
- 9000:9000

name: ${{ matrix.python-version }} CH=${{ matrix.clickhouse-version }}
steps:
Expand All @@ -27,11 +36,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Install test requirements
run: |
pip install --upgrade pip setuptools wheel
Expand All @@ -42,17 +46,6 @@ jobs:
pip install pytest-timeout
- name: Run flake8
run: flake8
- name: Setup /etc/hosts
run: |
# Overriding setup.cfg. Set host=clickhouse-server
sed -i 's/^host=localhost$/host=clickhouse-server/' setup.cfg
# Make host think that clickhouse-server is localhost
echo '127.0.0.1 clickhouse-server' | sudo tee /etc/hosts > /dev/null
- name: Start ClickHouse server container
run: |
echo "VERSION=${{ matrix.clickhouse-version }}" > tests/.env
if [[ "${{ matrix.clickhouse-version }}" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker compose -f tests/docker-compose.yml up -d
- name: Run tests
run: coverage run --source=clickhouse_sqlalchemy -m pytest --timeout=10 -v
timeout-minutes: 2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ on: [push, pull_request]
name: build-docs
jobs:
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Build docs
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
architecture: x64
- name: Update tools
run: pip install --upgrade pip setuptools wheel
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/sa-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
clickhouse-version:
- 23.8.4.69
sa-version: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
services:
clickhouse-server:
image: clickhouse/clickhouse-server:${{ matrix.clickhouse-version }}
ports:
- 8123:8123
- 9000:9000

name: ${{ matrix.python-version }} SA=2.0.${{ matrix.sa-version }}
steps:
Expand All @@ -20,11 +26,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Install test requirements
run: |
pip install --upgrade pip setuptools wheel
Expand All @@ -34,17 +35,6 @@ jobs:
pip install pytest-timeout
- name: Install SQLAlchemy
run: pip install sqlalchemy==2.0.${{ matrix.sa-version }}
- name: Setup /etc/hosts
run: |
# Overriding setup.cfg. Set host=clickhouse-server
sed -i 's/^host=localhost$/host=clickhouse-server/' setup.cfg
# Make host think that clickhouse-server is localhost
echo '127.0.0.1 clickhouse-server' | sudo tee /etc/hosts > /dev/null
- name: Start ClickHouse server container
run: |
echo "VERSION=${{ matrix.clickhouse-version }}" > tests/.env
if [[ "${{ matrix.clickhouse-version }}" > "21.7" ]]; then echo "ORG=clickhouse"; else echo "ORG=yandex" ; fi >> tests/.env
docker compose -f tests/docker-compose.yml up -d
- name: Run tests
run: pytest --timeout=10 -v
timeout-minutes: 2

0 comments on commit 523559e

Please sign in to comment.