Skip to content

more fixed

more fixed #82

Workflow file for this run

# **what?**
# Runs code quality checks, unit tests, and verifies python build on
# all code commited to the repository. This workflow should not
# require any secrets since it runs for PRs from forked repos.
# By default, secrets are not passed to workflows running from
# a forked repo.
# **why?**
# Ensure code for dbt meets a certain quality standard.
# **when?**
# This will run for all PRs, when code is pushed to a release
# branch, and when manually triggered.
name: Tests and Code Checks
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- released
permissions: write-all
# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
code-quality:
name: code-quality
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: |
3.8
3.9
3.10
3.11
- name: Install python dependencies
run: |
pip install --user --upgrade pip
pip install pre-commit
pip install -r requirements-dev.txt
pip --version
pre-commit --version
mypy --version
dbt --version
- name: Run Tests
run: |
tox -e py38,py39,py310,py311
- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
test-build:
strategy:
fail-fast: false
matrix:
image:
- intersystemsdc/iris-community:latest
- intersystemsdc/iris-community:preview
python:
- name: py38
version: 3.8
- name: py39
version: 3.9
- name: py310
version: 3.10
- name: py311
version: 3.11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: install dependencies
run: |
pip install tox
- name: Build Docker image
run: docker build -t dbt-iris:$GITHUB_SHA .
- name: Run Tests
run: |
tox -e ${{ matrix.python.name }}-iris -- --container containers.intersystems.com/intersystems/iris-community:latest
build:
needs:
- code-quality
- test-build
name: build packages
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
- run: git fetch --depth=1 origin '+refs/tags/*:refs/tags/*'
continue-on-error: true
- name: set version
id: set-version
run: |
VERSION=$(sed -n '0,/version = \(.*\)/s//\1/p' dbt/adapters/iris/__version__.py | tr -d '"' )
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b$(($(git tag -l "v${VERSION}b*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d b -f2)+1))
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }}
echo "version=$VERSION" >> $GITHUB_OUTPUT
sed -i "s/version = .*/version = \"${VERSION}\"/" dbt/adapters/iris/__version__.py
sed -i "s/package_version = .*/package_version = \"${VERSION}\"/" setup.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install python dependencies
run: |
pip install --user --upgrade pip
pip install --upgrade setuptools wheel twine check-wheel-contents tox
pip --version
- name: Build distributions
run: |
pip install -r requirements-iris.txt
./scripts/build-dist.sh
- name: Show distributions
run: ls -lh dist/
- name: Check distribution descriptions
run: |
twine check dist/*
- name: Check wheel contents
run: |
check-wheel-contents dist/*.whl --ignore W007,W008,W009
- uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: dist
path: dist/dbt_iris-${{ steps.set-version.outputs.version }}-py3-none-any.whl
- name: Create Release
id: create-release
uses: softprops/action-gh-release@v1
if: github.event_name != 'pull_request'
with:
tag_name: v${{ steps.set-version.outputs.version }}
prerelease: ${{ github.event_name != 'release' }}
files: dist/dbt_iris-${{ steps.set-version.outputs.version }}-py3-none-any.whl
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@release/v1.5
- uses: actions/checkout@v4
if: github.event_name == 'release'
with:
ref: main
- name: Bump version
if: github.event_name == 'release'
run: |
git config --global user.name 'ProjectBot'
git config --global user.email 'bot@users.noreply.github.com'
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
sed -i "s/version = .*/version = \"${VERSION}\"/" dbt/adapters/iris/__version__.py
sed -i "s/package_version = .*/package_version = \"${VERSION}\"/" setup.py
git add dbt/adapters/iris/__version__.py
git add setup.py
git commit -m 'auto bump version with release'
git push