From 2de8c5a1911efce40fba0d7633db5891d673fb78 Mon Sep 17 00:00:00 2001 From: Aron Bierbaum Date: Sat, 2 Mar 2024 11:11:58 -0600 Subject: [PATCH] ci: update github action to use services --- .github/workflows/actions.yml | 33 +++++++++++++++---------------- .github/workflows/docs.yml | 4 ++-- .github/workflows/sa-versions.yml | 22 ++++++--------------- 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index b5bf991..78a1249 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -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: @@ -17,6 +17,21 @@ jobs: - 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: @@ -26,11 +41,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 @@ -41,17 +51,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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 613f2e4..78aacdf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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 diff --git a/.github/workflows/sa-versions.yml b/.github/workflows/sa-versions.yml index 72c312b..ba596f5 100644 --- a/.github/workflows/sa-versions.yml +++ b/.github/workflows/sa-versions.yml @@ -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: @@ -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 @@ -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