From 9d9ad81053350d8dd539d3ebb2a4ae17e2e14dfc Mon Sep 17 00:00:00 2001 From: Daniil Roman Date: Mon, 3 Mar 2025 20:05:14 +0100 Subject: [PATCH 1/2] Automatic license check for Python --- .github/workflows/python-license-check.yml | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/python-license-check.yml diff --git a/.github/workflows/python-license-check.yml b/.github/workflows/python-license-check.yml new file mode 100644 index 0000000000..9e8ae07155 --- /dev/null +++ b/.github/workflows/python-license-check.yml @@ -0,0 +1,77 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will run license check for the Python project +# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python + +name: Python license check + +on: + push: + branches: [ "main" ] + paths: + - 'regtests/client/python/**' + pull_request: + branches: [ "main" ] + paths: + - 'regtests/client/python/**' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout Polaris project + uses: actions/checkout@v4 + + - name: Set up Python 3.7 + uses: actions/setup-python@v5 + with: + python-version: '3.7' + + - name: Cache Poetry + id: cache-poetry + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: ${{ runner.os }}-poetry-${{ hashFiles('regtests/client/python/poetry.lock') }} + restore-keys: | + ${{ runner.os }}-poetry- + + - name: Install Poetry + if: steps.cache-poetry.outputs.cache-hit != 'true' + run: | + curl -sSL https://install.python-poetry.org | python3 - + export PATH="$HOME/.local/bin:$PATH" + + - name: Install dependencies and pip-licenses + working-directory: regtests/client/python + run: | + poetry install + pip install pip-licenses + + - name: Check Licenses + working-directory: regtests/client/python + run: | + pip-licenses --partial-match --fail-on="GPL;AGPL;LGPL;SSPL;EPL" From 1a582920d652b82815beffe39cfd203c7a8c3299 Mon Sep 17 00:00:00 2001 From: Daniil Roman Date: Sun, 23 Mar 2025 21:35:39 +0100 Subject: [PATCH 2/2] Update after moving python client to root dir --- .github/workflows/python-license-check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-license-check.yml b/.github/workflows/python-license-check.yml index 9e8ae07155..23a845b642 100644 --- a/.github/workflows/python-license-check.yml +++ b/.github/workflows/python-license-check.yml @@ -30,11 +30,11 @@ on: push: branches: [ "main" ] paths: - - 'regtests/client/python/**' + - 'client/python/**' pull_request: branches: [ "main" ] paths: - - 'regtests/client/python/**' + - 'client/python/**' jobs: build: @@ -55,7 +55,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pypoetry - key: ${{ runner.os }}-poetry-${{ hashFiles('regtests/client/python/poetry.lock') }} + key: ${{ runner.os }}-poetry-${{ hashFiles('client/python/poetry.lock') }} restore-keys: | ${{ runner.os }}-poetry- @@ -66,12 +66,12 @@ jobs: export PATH="$HOME/.local/bin:$PATH" - name: Install dependencies and pip-licenses - working-directory: regtests/client/python + working-directory: client/python run: | poetry install pip install pip-licenses - name: Check Licenses - working-directory: regtests/client/python + working-directory: client/python run: | pip-licenses --partial-match --fail-on="GPL;AGPL;LGPL;SSPL;EPL"