From dde3298bf1b3280c65e3fe96674f7cc360d4aa48 Mon Sep 17 00:00:00 2001 From: Pierre Schnizer Date: Wed, 10 Jul 2024 16:16:37 +0200 Subject: [PATCH 1/4] [TASK] add CI --- .github/workflows/python-package.yml | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..8c90258 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,45 @@ +name: Python package + +on: + push: + branches: [ "dev/main" ] + pull_request: + branches: [ "dev/main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install . + - name: Install package + run: | + python -m pip install flake8 pytest + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + # - name: Test with pytest + # run: | + # pytest From 1acea7d3ae60ed9b80b288b4358822667cde0db1 Mon Sep 17 00:00:00 2001 From: Pierre Schnizer Date: Wed, 10 Jul 2024 16:26:58 +0200 Subject: [PATCH 2/4] [FIX] install dependent bact package first --- .github/workflows/python-package.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8c90258..14266d8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,6 +31,13 @@ jobs: python -m pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install . + - name: Install bact dependencies bact-device-models + run: | + t_dir=bact-device-models + if [ -f $t_dir/requirements.txt ]; then pip install -r $t_dir/requirements.txt; fi + # make it a path, otherwise it searches pypi repo + pip install $t_dir/ + - name: Install package run: | python -m pip install flake8 pytest From 9d5162054625f9c608156b39fd5625487f8de970 Mon Sep 17 00:00:00 2001 From: Pierre Schnizer Date: Wed, 10 Jul 2024 16:28:41 +0200 Subject: [PATCH 3/4] [FIX] install bact dependencies before the package --- .github/workflows/python-package.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 14266d8..9d14f3d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -25,18 +25,18 @@ jobs: cache-dependency-path: | **/pyproject.toml **/requirements*.txt - - name: Install dependencies - run: | - python -m pip install --upgrade pip wheel - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install . - name: Install bact dependencies bact-device-models run: | t_dir=bact-device-models if [ -f $t_dir/requirements.txt ]; then pip install -r $t_dir/requirements.txt; fi # make it a path, otherwise it searches pypi repo pip install $t_dir/ + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install . - name: Install package run: | From 5d59007ebe3df97873f96b6186348517fb1e28cf Mon Sep 17 00:00:00 2001 From: Pierre Schnizer Date: Wed, 10 Jul 2024 16:32:26 +0200 Subject: [PATCH 4/4] [FIX] checkout bact external packages before test --- .github/workflows/python-package.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9d14f3d..a05c2fe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,6 +15,7 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] + steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -25,12 +26,20 @@ jobs: cache-dependency-path: | **/pyproject.toml **/requirements*.txt + + - name: Checkout bact-device-models + uses: actions/checkout@v4 + with: + repository: hz-b/bact-device-models + path: bact-device-models + - name: Install bact dependencies bact-device-models run: | t_dir=bact-device-models if [ -f $t_dir/requirements.txt ]; then pip install -r $t_dir/requirements.txt; fi # make it a path, otherwise it searches pypi repo pip install $t_dir/ + - name: Install dependencies run: | python -m pip install --upgrade pip wheel @@ -47,6 +56,7 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + # - name: Test with pytest # run: | # pytest