mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-27 08:00:28 +00:00
The only advantage of localkube was being a low weight. Anything else started creating only problems: 1. It is not properly maintained for many years. 2. It effectively worked only on Linux, but stopped on modern version due to changes in iptables. Instead, we will use widely adoped tools like kind or k3s. The "kind-kind" is the default K8s context (see ~/.kube/config), but it could be overriden using `PATRONI_KUBERNETES_CONTEXT` environment variable. When executed from GH actions the context is set to k3d-k3s-default, because K3s is much faster to start.
158 lines
4.7 KiB
YAML
158 lines
4.7 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- v.*
|
|
|
|
jobs:
|
|
unit:
|
|
runs-on: ${{ fromJson('{"ubuntu":"ubuntu-20.04","windows":"windows-latest","macos":"macos-latest"}')[matrix.os] }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu, windows, macos]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python 2.7
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 2.7
|
|
if: matrix.os != 'windows'
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
if: matrix.os != 'windows'
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
if: matrix.os != 'windows'
|
|
|
|
- name: Set up Python 3.6
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.6
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
|
|
- name: Set up Python 3.7
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.7
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.9
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run tests and flake8
|
|
run: python .github/workflows/run_tests.py
|
|
|
|
- name: Combine coverage
|
|
run: python .github/workflows/run_tests.py combine
|
|
|
|
- name: Install coveralls
|
|
run: python -m pip install coveralls
|
|
|
|
- name: Upload Coverage
|
|
env:
|
|
COVERALLS_FLAG_NAME: unit-${{ matrix.os }}
|
|
COVERALLS_PARALLEL: 'true'
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
run: python -m coveralls --service=github
|
|
|
|
behave:
|
|
runs-on: ${{ fromJson('{"ubuntu":"ubuntu-20.04","windows":"windows-latest","macos":"macos-latest"}')[matrix.os] }}
|
|
env:
|
|
DCS: ${{ matrix.dcs }}
|
|
ETCDVERSION: 3.3.13
|
|
PGVERSION: 12.1-1 # for windows and macos
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu]
|
|
python-version: [2.7, 3.6, 3.9]
|
|
dcs: [etcd, etcd3, consul, exhibitor, kubernetes, raft]
|
|
exclude:
|
|
- dcs: kubernetes
|
|
python-version: 2.7
|
|
include:
|
|
- os: macos
|
|
python-version: 3.7
|
|
dcs: raft
|
|
- os: macos
|
|
python-version: 3.8
|
|
dcs: etcd
|
|
- os: macos
|
|
python-version: '3.10'
|
|
dcs: etcd3
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- uses: nolar/setup-k3d-k3s@v1
|
|
if: matrix.dcs == 'kubernetes'
|
|
- name: Add postgresql apt repo
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y wget ca-certificates gnupg
|
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
|
sudo sh -c 'wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg'
|
|
if: matrix.os == 'ubuntu'
|
|
- name: Install dependencies
|
|
run: python .github/workflows/install_deps.py
|
|
- name: Run behave tests
|
|
run: python .github/workflows/run_tests.py
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
- name: Install coveralls
|
|
run: python -m pip install coveralls
|
|
- name: Upload Coverage
|
|
env:
|
|
COVERALLS_FLAG_NAME: behave-${{ matrix.os }}-${{ matrix.dcs }}-${{ matrix.python-version }}
|
|
COVERALLS_PARALLEL: 'true'
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
|
run: python -m coveralls --service=github
|
|
|
|
coveralls-finish:
|
|
name: Finalize coveralls.io
|
|
needs: [unit, behave]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-python@v4
|
|
- run: python -m pip install coveralls
|
|
- run: python -m coveralls --service=github --finish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|