File: test-package.yml

package info (click to toggle)
ormar 0.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,952 kB
  • sloc: python: 24,085; makefile: 34; sh: 14
file content (118 lines) | stat: -rw-r--r-- 3,606 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: test

on:
  push:
    branches-ignore:
      - 'gh-pages'
  pull_request:
    branches: [ master, pydantic_v2 ]

jobs:
  tests:
    name: "Python ${{ matrix.python-version }}"
    runs-on: ubuntu-latest
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'collerek/ormar'
    strategy:
      matrix:
        python-version: [3.9, "3.10", 3.11, 3.12]
      fail-fast: false
    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_USER: username
          MYSQL_PASSWORD: password
          MYSQL_ROOT_PASSWORD: password
          MYSQL_DATABASE: testsuite
        ports:
          - 3306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

      postgres:
        image: postgres:10.8
        env:
          POSTGRES_USER: username
          POSTGRES_PASSWORD: password
          POSTGRES_DB: testsuite
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 --name postgres

    steps:
    - name: Checkout
      uses: actions/checkout@v6
      with:
        submodules: false
    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install Poetry
      uses: snok/install-poetry@v1.4
      with:
        version: 2.1.3
        virtualenvs-create: false

    - name: Poetry details
      run: |
        poetry --version
        poetry config --list

    - name: Install dependencies
      run: poetry install --extras "all"

    - name: Run mysql
      env:
        DATABASE_URL: "mysql://username:password@127.0.0.1:3306/testsuite"
      run: bash scripts/test.sh

    - name: Install postgresql-client
      run: |
        sudo apt-get update
        sudo apt-get install --yes postgresql-client

    - name: Connect to PostgreSQL with CLI
      run: env PGPASSWORD=password psql -h localhost -U username -c 'SELECT VERSION();' testsuite

    - name: Show max connections
      run: env PGPASSWORD=password psql -h localhost -U username -c 'SHOW max_connections;' testsuite

    - name: Alter max connections
      run: |
        
        docker exec -i postgres bash << EOF
          sed -i -e 's/max_connections = 100/max_connections = 1000/' /var/lib/postgresql/data/postgresql.conf
          sed -i -e 's/shared_buffers = 128MB/shared_buffers = 512MB/' /var/lib/postgresql/data/postgresql.conf
        EOF
        docker restart --time 0 postgres
        sleep 5

    - name: Show max connections
      run: env PGPASSWORD=password psql -h localhost -U username -c 'SHOW max_connections;' testsuite

    - name: Run postgres
      env:
        DATABASE_URL: "postgresql://username:password@localhost:5432/testsuite"
      run: bash scripts/test.sh

    - name: Run sqlite
      env:
        DATABASE_URL: "sqlite:///testsuite"
      run: bash scripts/test.sh

    - name: Upload coverage
      uses: codecov/codecov-action@v5.5.2
      with:
        name: codecov-umbrella
        token: ${{ secrets.CODCOV_TOKEN }}
        verbose: true

    - name: Test & publish code coverage
      uses: paambaati/codeclimate-action@v9.0.0
      if: github.event.pull_request.head.repo.full_name == 'collerek/ormar'
      env:
        CC_TEST_REPORTER_ID:  ${{ secrets.CC_COVERAGE_TOKEN }}