chore: Update template to 0.2.1 (#9) #16
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
# Automatically stop old builds on the same branch/PR | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
pre-commit: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up pixi | |
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1 | |
with: | |
environments: default lint | |
- name: pre-commit | |
run: pixi run pre-commit-run --color=always --show-diff-on-failure | |
pytest: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
services: | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
env: | |
ACCEPT_EULA: Y | |
SA_PASSWORD: Passw0rd | |
ports: | |
- 1433:1433 | |
strategy: | |
fail-fast: false | |
matrix: | |
environment: | |
- py311 | |
- py312 | |
database: | |
- sqlite | |
- mssql | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
- name: Install msodbcsql18 | |
if: matrix.database == 'mssql' | |
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y | |
- name: Set up pixi | |
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1 | |
with: | |
environments: ${{ matrix.environment }} | |
- name: Install repository | |
run: pixi run -e ${{ matrix.environment }} postinstall | |
- name: Set DB connection string | |
run: | | |
if [ "${{ matrix.database }}" == "sqlite" ]; then | |
echo "DB_CONNECTION_STRING=sqlite:///test.sqlite3" >> $GITHUB_ENV | |
else | |
echo "DB_CONNECTION_STRING=mssql+pyodbc://sa:Passw0rd@localhost:1433/master?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=no" >> $GITHUB_ENV | |
fi | |
- name: Run pytest | |
run: pixi run -e ${{ matrix.environment }} test-coverage --color=yes |