From 98f84ba40cfd734653445ae0792c59eb157bd2f1 Mon Sep 17 00:00:00 2001 From: Dmitry Maslennikov Date: Thu, 23 Mar 2023 12:51:43 +0400 Subject: [PATCH] update ci --- .github/workflows/codeql.yml | 41 ++++++++++++++++++++++++++++ .github/workflows/python-publish.yml | 11 ++++++-- requirements-iris.txt | 1 + scripts/build-dist.sh | 34 +++++++++++++++++++++++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/codeql.yml create mode 100644 requirements-iris.txt create mode 100755 scripts/build-dist.sh diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ee3827e --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: "29 13 * * 1" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ python ] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{ matrix.language }}" \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 78f1736..ca502de 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -40,8 +40,15 @@ jobs: echo ::set-output name=version::$VERSION NAME="sqlalchemy_iris"-${VERSION}-py3-none-any echo ::set-output name=name::$NAME - - name: Build package - run: python -m build + - name: Install requirements + run: | + pip install -U pip setuptools + pip install -r requirements-dev.txt + pip install -r requirements-iris.txt + pip install -e . + + - name: Build Python package + run: ./scripts/build-dist.sh - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1.5 with: diff --git a/requirements-iris.txt b/requirements-iris.txt new file mode 100644 index 0000000..872d8e7 --- /dev/null +++ b/requirements-iris.txt @@ -0,0 +1 @@ +https://github.com/intersystems-community/intersystems-irispython/releases/download/3.4.2/intersystems_iris-3.4.2-py3-none-any.whl \ No newline at end of file diff --git a/scripts/build-dist.sh b/scripts/build-dist.sh new file mode 100755 index 0000000..7706ed1 --- /dev/null +++ b/scripts/build-dist.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +packages=("iris" "intersystems_iris" "irisnative") +for package in ${packages[@]}; +do + rm -f ./$package + package_path=`python -c "import importlib.util; print(importlib.util.find_spec('${package}').submodule_search_locations[0])"` + ln -s $package_path ./$package +done + +set -eo pipefail + +PROJECT="$( cd "$(dirname "$0")/.." ; pwd -P )" + +PYTHON_BIN=${PYTHON_BIN:-python3} + +echo "$PYTHON_BIN" + +set -x + +rm -rf "$PROJECT"/dist +rm -rf "$PROJECT"/build +mkdir -p "$PROJECT"/dist + +cd "$PROJECT" +$PYTHON_BIN setup.py sdist bdist_wheel + +for package in ${packages[@]}; +do + rm -f $package +done +rm -rf intersystems-irispython + +set +x