Skip to content

fix: lazy validator default value would evalute early #829

fix: lazy validator default value would evalute early

fix: lazy validator default value would evalute early #829

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [master]
paths-ignore: # run if anything different from these is modified
- "docs/**"
- "mkdocs.yml"
pull_request:
branches: [master]
paths-ignore:
- "docs/**"
- "mkdocs.yml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# When a Push is made on an existing branch/PR
# it cancels any pre running job and
# let only the latest executing
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
linter:
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install and lint
run: make clean install run-pre-commit
install_test:
needs: linter
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
continue-on-error: true
run: pip install --user --upgrade pip
# NOTE: Remove setuptools install below when project moves to pyproject!
- name: Install setuptools for Python 3.12
if: ${{ matrix.python-version == '3.12' }}
run: pip install --user --upgrade setuptools
- name: Install project and test cli
run: |
python setup.py install
dynaconf init -v FOO=running_on_ci -y
dynaconf -i config.settings write toml -v OTHERVALUE=Hello_CI -y
dynaconf -i config.settings list | grep -c running_on_ci
dynaconf -i config.settings list | grep -c Hello_CI
dynaconf --version
unit_tests_linux:
needs: install_test
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install project
run: make ciinstall
- name: Run tests
run: make citest
- name: Publish Junit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
continue-on-error: true
if: always()
with:
files: junit/**/*.xml
check_name: Test Results (Python ${{ matrix.python-version }})
- name: "Upload coverage to Codecov"
if: ${{ matrix.python-version == '3.11' }}
uses: codecov/codecov-action@v4
continue-on-error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: coverage.xml
fail_ci_if_error: true
unit_tests_mac:
needs: install_test
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install project
run: make ciinstall
- name: Run tests
run: py.test -v --cov-config .coveragerc --cov=dynaconf -l tests/ --junitxml=junit/test-results.xml -m "not integration"
functional_tests_linux_mac:
needs:
- unit_tests_linux
- unit_tests_mac
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install project
run: make ciinstall
- name: Run functional tests
run: make test_functional
unit_tests_windows:
needs: install_test
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Pip
run: pip install --user --upgrade pip
continue-on-error: true
- name: Install project
run: pip install --use-deprecated=legacy-resolver .[test]
- name: run tests
run: py.test -v -l tests --junitxml=junit/test-results.xml -m "not integration"
functional_tests_windows:
needs: unit_tests_windows
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Pip
continue-on-error: true
run: pip install --user --upgrade pip
- name: Install project
run: pip install --use-deprecated=legacy-resolver .[test]
- name: run tests
run: python tests_functional/runtests.py
redis:
needs: functional_tests_linux_mac
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install project
run: make ciinstall
- name: Run functional tests
run: make test_redis
vault:
needs: functional_tests_linux_mac
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
vault:
image: hashicorp/vault:latest
ports:
- 8200:8200
env:
VAULT_DEV_ROOT_TOKEN_ID: myroot
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade PIP
run: pip install --user --upgrade pip
- name: Install project
run: make ciinstall
- name: Run functional tests
run: make test_vault
checkpoint:
runs-on: ubuntu-latest
needs:
- linter
- install_test
- unit_tests_windows
- unit_tests_mac
- unit_tests_linux
- functional_tests_linux_mac
- functional_tests_windows
- redis
- vault
steps:
- name: All tests has passed
run: echo "All tests has passed"