mraba/gh-actions-update: bump github actions versions to latest #573
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
- prep-** | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
default: warning | |
description: "Log level" | |
required: true | |
tags: | |
description: "Test scenario tags" | |
jobs: | |
lint: | |
name: Check linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Upgrade and install tools | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U hatch | |
python -m hatch env create default | |
- name: Set PY | |
run: echo "PY=$(hatch run gh-cache-sum)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run lint checks | |
run: hatch run check | |
build-install: | |
name: Test package build and installation | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Upgrade and install tools | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U hatch | |
- name: Build package | |
run: | | |
python -m hatch clean | |
python -m hatch build | |
- name: Install and check import | |
run: | | |
python -m pip install dist/snowflake_sqlalchemy-*.whl | |
python -c "import snowflake.sqlalchemy; print(snowflake.sqlalchemy.__version__)" | |
test-dialect: | |
name: Test dialect ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
needs: [ lint, build-install ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
ubuntu-latest, | |
macos-latest, | |
windows-latest, | |
] | |
python-version: ["3.8"] | |
cloud-provider: [ | |
aws, | |
azure, | |
gcp, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip and prepare environment | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U hatch | |
python -m hatch env create default | |
- name: Setup parameters file | |
shell: bash | |
env: | |
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} | |
run: | | |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ | |
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py | |
- name: Run tests | |
run: hatch run test-dialect | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage.xml_dialect-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
path: | | |
./coverage.xml | |
test-dialect-compatibility: | |
name: Test dialect compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
needs: [ lint, build-install ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
ubuntu-latest, | |
macos-latest, | |
windows-latest, | |
] | |
python-version: ["3.8"] | |
cloud-provider: [ | |
aws, | |
azure, | |
gcp, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip and install hatch | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U hatch | |
python -m hatch env create default | |
- name: Setup parameters file | |
shell: bash | |
env: | |
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} | |
run: | | |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ | |
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py | |
- name: Run tests | |
run: hatch run test-dialect-compatibility | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
path: | | |
./coverage.xml | |
test-dialect-run-v20: | |
name: Test dialect run v20 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
needs: [ lint, build-install ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
ubuntu-latest, | |
macos-latest, | |
windows-latest, | |
] | |
python-version: ["3.8"] | |
cloud-provider: [ | |
aws, | |
azure, | |
gcp, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup parameters file | |
shell: bash | |
env: | |
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} | |
run: | | |
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ | |
.github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py | |
- name: Upgrade pip and install hatch | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U hatch | |
python -m hatch env create default | |
- name: Run tests | |
run: hatch run test-run_v20 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage.xml_dialect-run-20-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
path: | | |
./coverage.xml | |
combine-coverage: | |
name: Combine coverage | |
if: ${{ success() || failure() }} | |
needs: [test-dialect, test-dialect-compatibility, test-dialect-run-v20] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
- name: Prepare environment | |
run: | | |
pip install -U pip | |
pip install -U hatch | |
hatch env create default | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: Combine coverage files | |
run: | | |
hatch run coverage combine -a artifacts/coverage.xml_*/coverage.xml | |
hatch run coverage report -m | |
hatch run coverage xml -o combined_coverage.xml | |
hatch run coverage html -d htmlcov | |
- name: Store coverage reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: combined_coverage.xml | |
path: combined_coverage.xml | |
- name: Store htmlcov report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: combined_htmlcov | |
path: htmlcov | |
- name: Uplaod to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: combined_coverage.xml | |
env_vars: OS,PYTHON | |
fail_ci_if_error: false | |
flags: unittests | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
url: https://snowflake.codecov.io/ |