From d250df1ec69b8abe994f17e33506615a074769e3 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:49:25 +0200 Subject: [PATCH 01/21] move to gh actions --- .github/workflows/test | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/test diff --git a/.github/workflows/test b/.github/workflows/test new file mode 100644 index 0000000..4aee600 --- /dev/null +++ b/.github/workflows/test @@ -0,0 +1,56 @@ +name: pytest-stf + +on: + push: + branches: [ "master" ] + tags: + - v* + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.7', '3.8', '3.9', '3.10'] + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + pip install .[dev] + - 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: Build coverage file + run: | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pytest_lockable test/ | tee pytest-coverage.txt + + - name: install release deps + if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' + run: | + pip install wheel twine + python setup.py sdist + python setup.py bdist_wheel + - name: upload to pypi + if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' + env: + TWINE_USERNAME: "${{secrets.TWINE_USERNAME}}" + TWINE_PASSWORD: "${{secrets.TWINE_PASSWORD}}" + run: | + export PATH=$HOME/.local/bin:$PATH; + twine upload dist/* From e573d36c90fcaf34b1a3020c897605f5b9f0961f Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:50:00 +0200 Subject: [PATCH 02/21] Delete config.yml --- .circleci/config.yml | 116 ------------------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 652d210..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,116 +0,0 @@ -# Python CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-python/ for more details -# -version: 2.1 - -workflows: - version: 2 - test: - jobs: - - test-37: - filters: - tags: - only: /.*/ - - test-38: - filters: - tags: - only: /.*/ - - test-39: - filters: - tags: - only: /.*/ - - deploy: - requires: - - test-39 - - test-38 - - test-37 - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ - -commands: - setup: - steps: - - checkout - # Download and cache dependencies - - restore_cache: - key: deps1-{{ .Branch }}-{{ checksum "setup.py" }} - - run: - name: install dependencies - command: | - python --version - virtualenv venv - . venv/bin/activate; - pip install -e .; - pip install -e .[dev] - pip install -e .[optional] - - save_cache: - paths: - - ./venv - key: deps1-{{ .Branch }}-{{ checksum "setup.py" }} - -jobs: - test-37: &test-template - docker: - - image: circleci/python:3.7 - working_directory: ~/pytest-lockable - steps: - - setup - # run tests! - - run: - name: unit tests - command: | - mkdir junit || true - . venv/bin/activate; - nosetests --with-xunit --with-coverage --cover-package=pytest_lockable --cover-html --cover-html-dir=htmlcov --cover-xml-file=coverage.xml --xunit-file=junit/results.xml - coveralls || true - - run: - name: pylint - command: | - . venv/bin/activate; - pylint pytest_lockable - - run: - name: run - command: | - . venv/bin/activate; - cd example; - pytest --allocation_hostname localhost -s --allocation_lock_folder . - - store_artifacts: - path: htmlcov - destination: htmlcov - - store_test_results: - path: junit - - store_artifacts: - path: junit - destination: juni - - test-38: - <<: *test-template - docker: - - image: circleci/python:3.8 - - test-39: - <<: *test-template - docker: - - image: circleci/python:3.9-rc-buster - - deploy: - <<: *test-template - steps: - - setup - - run: - name: create packages - command: | - . venv/bin/activate; - python setup.py sdist - python setup.py bdist_wheel - - run: - name: upload to pypi - command: | - . venv/bin/activate; - pip install twine; - export PATH=$HOME/.local/bin:$PATH; - twine upload dist/* From da09a95dadcdd201637ae06cc585032481863cb3 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:51:10 +0200 Subject: [PATCH 03/21] Update test --- .github/workflows/test | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test b/.github/workflows/test index 4aee600..aeda472 100644 --- a/.github/workflows/test +++ b/.github/workflows/test @@ -6,7 +6,6 @@ on: tags: - v* pull_request: - branches: [ "master" ] permissions: contents: read From a96a726919b56722b76176ff1ff9f9aa7d246cd9 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:52:42 +0200 Subject: [PATCH 04/21] Update and rename test to test.yml --- .github/workflows/{test => test.yml} | 2 -- 1 file changed, 2 deletions(-) rename .github/workflows/{test => test.yml} (98%) diff --git a/.github/workflows/test b/.github/workflows/test.yml similarity index 98% rename from .github/workflows/test rename to .github/workflows/test.yml index aeda472..f88bba9 100644 --- a/.github/workflows/test +++ b/.github/workflows/test.yml @@ -1,5 +1,3 @@ -name: pytest-stf - on: push: branches: [ "master" ] From b277a47028aec774b0ecaa7b14397eb6ff24d60e Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:56:38 +0200 Subject: [PATCH 05/21] Update test.yml --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f88bba9..fd32869 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,8 @@ jobs: python -m pip install --upgrade pip pip install . pip install .[dev] + pip install .[optional] + pip install flake - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -36,7 +38,10 @@ jobs: - name: Build coverage file run: | pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pytest_lockable test/ | tee pytest-coverage.txt - + - name: run example + working-directory: example + run: | + pytest --allocation_hostname localhost -s --allocation_lock_folder . - name: install release deps if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' run: | From cadacec916386834a351459eaa24bed0cbbb75bb Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:57:32 +0200 Subject: [PATCH 06/21] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd32869..e0b5cfe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: pip install . pip install .[dev] pip install .[optional] - pip install flake + pip install flake8 - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names From 2b93b071b5ce968c54192b8cc3914d3ecb65d9f5 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 21:58:49 +0200 Subject: [PATCH 07/21] Update test.yml --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e0b5cfe..b75ebf7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,8 @@ 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: pylint + run: pylint pytest_lockable - name: Build coverage file run: | pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pytest_lockable test/ | tee pytest-coverage.txt From 2c7c819bc3caaf296012f0b1d6f48d4976659bd6 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:00:43 +0200 Subject: [PATCH 08/21] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b75ebf7..5081d44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,8 @@ jobs: 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 + # The GitHub editor is 127 chars wide + flake8 . --count --max-complexity=10 --max-line-length=127 --statistics - name: pylint run: pylint pytest_lockable - name: Build coverage file From 445012a69c0ce43e56f5bff9de93fca8d547549e Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:05:11 +0200 Subject: [PATCH 09/21] Update test.yml --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5081d44..b181963 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,11 @@ jobs: - name: Build coverage file run: | pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pytest_lockable test/ | tee pytest-coverage.txt + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: run example working-directory: example run: | From a9e220e6ad90c1b15015910d1f15962ef27cc9a1 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:06:52 +0200 Subject: [PATCH 10/21] Create sonar-project.properties --- sonar-project.properties | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..a4e5072 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=jupe_pytest-lockable +sonar.organization=jupe + +# This is the name and version displayed in the SonarCloud UI. +sonar.projectName=pytest-lockable +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=pytest_lockable +sonar.python.coverage.reportPaths=coverage.xml +sonar.python.xunit.reportPath=coverage.xml From bf570e52d3dc20581797415f7d4431c13f4179e4 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:09:03 +0200 Subject: [PATCH 11/21] Update sonar-project.properties --- sonar-project.properties | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index a4e5072..ce28f0a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,9 +3,7 @@ sonar.organization=jupe # This is the name and version displayed in the SonarCloud UI. sonar.projectName=pytest-lockable -#sonar.projectVersion=1.0 - -# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=pytest_lockable +sonar.tests=tests sonar.python.coverage.reportPaths=coverage.xml -sonar.python.xunit.reportPath=coverage.xml +sonar.python.xunit.reportPath=results.xml From fd8223540958146b37ed9cc4160b527b579e64c0 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:10:47 +0200 Subject: [PATCH 12/21] Update test.yml --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b181963..246ecd0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,8 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pytest_lockable test/ | tee pytest-coverage.txt + pytest --junitxml=results.xml --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ | tee pytest-coverage.txt + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From cd11de870122edf134487970085b8a942cdf892d Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:17:48 +0200 Subject: [PATCH 13/21] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 246ecd0..94c8d95 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,8 +38,8 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - pytest --junitxml=results.xml --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ | tee pytest-coverage.txt - + pytest --junitxml=results.xml --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ + ls -l - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From fb1c7502a97eb7b36be516386d7716f572a69d0d Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:22:35 +0200 Subject: [PATCH 14/21] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94c8d95..ee9b60c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - pytest --junitxml=results.xml --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ + pytest --junitxml=results.xml --cov-report term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ ls -l - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master From 8a03e3169eac5e65f9001eeb6fb54388c19341a2 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:30:18 +0200 Subject: [PATCH 15/21] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee9b60c..e73da5e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,8 +38,8 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - pytest --junitxml=results.xml --cov-report term-missing:skip-covered --cov-report xml:coverage.xml --cov=pytest_lockable test/ - ls -l + python3 -m coverage run --source pytest_lockable -m xmlrunner discover -s tests --output-file results.xml + python3 -m coverage xml -o coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From 608c7d2f08eeb47e2d017e1d0539993f05269d2e Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:32:48 +0200 Subject: [PATCH 16/21] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b857810..29e48d4 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ 'lockable>=0.8.0,<0.9.0' ], extras_require={ # Optional - 'dev': ['nose', 'coveralls', 'pylint', 'coverage'], + 'dev': ['nose', 'coveralls', 'pylint', 'coverage', 'unittest-xml-reportin'], 'optional': ['pytest-metadata'] }, From 7134ee3b8734cd5e3b3ebcc28eab7ef31a44130c Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:36:07 +0200 Subject: [PATCH 17/21] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e73da5e..7e2f02e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,8 +38,8 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - python3 -m coverage run --source pytest_lockable -m xmlrunner discover -s tests --output-file results.xml - python3 -m coverage xml -o coverage.xml + nosetests --with-xunit --with-coverage --cover-package=pytest_lockable --cover-html --cover-html-dir=htmlcov --cover-xml-file=coverage.xml --xunit-file=results.xml + coveralls || true - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From fccb521a74f99793a0e6aadc3aa355af59c0dc55 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:38:02 +0200 Subject: [PATCH 18/21] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 29e48d4..b857810 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ 'lockable>=0.8.0,<0.9.0' ], extras_require={ # Optional - 'dev': ['nose', 'coveralls', 'pylint', 'coverage', 'unittest-xml-reportin'], + 'dev': ['nose', 'coveralls', 'pylint', 'coverage'], 'optional': ['pytest-metadata'] }, From 6d03580e8e4c185939670f937f598f9735456820 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:42:12 +0200 Subject: [PATCH 19/21] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b857810..572c85b 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ 'lockable>=0.8.0,<0.9.0' ], extras_require={ # Optional - 'dev': ['nose', 'coveralls', 'pylint', 'coverage'], + 'dev': ['coveralls', 'pylint', 'coverage', 'unittest-xml-reporting'], 'optional': ['pytest-metadata'] }, From c3d508675d8af1f15a14e3a2c4027244649b4ddc Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:43:14 +0200 Subject: [PATCH 20/21] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e2f02e..e73da5e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,8 +38,8 @@ jobs: run: pylint pytest_lockable - name: Build coverage file run: | - nosetests --with-xunit --with-coverage --cover-package=pytest_lockable --cover-html --cover-html-dir=htmlcov --cover-xml-file=coverage.xml --xunit-file=results.xml - coveralls || true + python3 -m coverage run --source pytest_lockable -m xmlrunner discover -s tests --output-file results.xml + python3 -m coverage xml -o coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: From 27df56deb6e48508f9091592c22d4d9ad99fc3b3 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Sun, 20 Nov 2022 22:49:53 +0200 Subject: [PATCH 21/21] Update test.yml --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e73da5e..19a5d53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,7 @@ jobs: python3 -m coverage xml -o coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master + if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}