From b67af13b23cd2baded4137afb47466f7e673157c Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Fri, 14 Oct 2022 17:27:08 +0200 Subject: [PATCH 1/5] Split package build from testing --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++-------- pyproject.toml | 8 +++++-- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55f5d65..e1429ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,31 @@ on: [push, pull_request] jobs: build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v1 + - uses: actions/setup-python@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build + run: python -m build + - name: Upload source distribution + uses: actions/upload-artifact@v3 + with: + name: sdist + path: "dist/*.tar.gz" + if-no-files-found: error + - name: Upload wheel + uses: actions/upload-artifact@v3 + with: + name: wheel + path: "dist/*.whl" + if-no-files-found: error + + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -26,15 +51,6 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest cffi - - - name: Build - run: | - pip install -e . - - name: Cache Mono if: runner.os == 'Windows' uses: actions/cache@v2 @@ -47,6 +63,17 @@ jobs: run: | choco install -y mono ${{ matrix.python == 'pypy3' && '--x86' || '' }} + - name: Download wheel + uses: actions/download-artifact@v3 + with: + name: wheel + + - name: Install wheel and deps + run: | + python -m pip install --upgrade pip + pip install dist/*.whl + pip install pytest + - name: Test with pytest run: | pytest diff --git a/pyproject.toml b/pyproject.toml index d344968..5491c06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [build-system] -requires = ["setuptools>=61", "wheel"] +requires = ["setuptools>=61", "setuptools_scm[toml]", "wheel"] build-backend = "setuptools.build_meta" [project] name = "clr_loader" description = "Generic pure Python loader for .NET runtimes" license = {text = "MIT"} -version = "0.2.3" +requires-python = ">=3.7" readme = "README.md" @@ -22,6 +22,8 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", ] +dynamic = ["version"] + [[project.authors]] name = "Benedikt Reinartz" email = "filmor@gmail.com" @@ -37,6 +39,8 @@ package-data = {"clr_loader.ffi" = ["dlls/x86/*.dll", "dlls/amd64/*.dll"]} [tool.setuptools.packages.find] include = ["clr_loader*"] +[tool.setuptools_scm] + [tool.pytest.ini_options] xfail_strict = true testpaths = [ From a103943351aaeb14672f203396752422388f4cdc Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Fri, 14 Oct 2022 17:36:32 +0200 Subject: [PATCH 2/5] Fix wheel location and tag download --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1429ad..71a285d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-dotnet@v1 - uses: actions/setup-python@v2 - name: Install dependencies @@ -71,7 +73,7 @@ jobs: - name: Install wheel and deps run: | python -m pip install --upgrade pip - pip install dist/*.whl + pip install ./*.whl pip install pytest - name: Test with pytest From 0fe6daed8052a9419fcc7e6317b116fa49d80436 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Fri, 14 Oct 2022 17:37:34 +0200 Subject: [PATCH 3/5] Add build as job dependency --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71a285d..cc38207 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: test: runs-on: ${{ matrix.os }} + needs: build strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] From 18e66b6cf152048794665c734de3a449d1f89ee2 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Fri, 14 Oct 2022 17:42:46 +0200 Subject: [PATCH 4/5] Update actions --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc38207..424a0e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,11 +9,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-dotnet@v1 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -42,7 +42,7 @@ jobs: python: ['3.10', '3.9', '3.8', '3.7'] # pypy3 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v1 @@ -50,7 +50,7 @@ jobs: dotnet-version: '6.0.x' - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} From f6756395f7ea1e100871cf5f350c3788057a9946 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Fri, 14 Oct 2022 22:38:02 +0200 Subject: [PATCH 5/5] Fix wheel lookup on Windows --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 424a0e5..b4e25f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,16 +66,21 @@ jobs: run: | choco install -y mono ${{ matrix.python == 'pypy3' && '--x86' || '' }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + - name: Download wheel uses: actions/download-artifact@v3 with: name: wheel + path: dist/ - - name: Install wheel and deps + - name: Install wheel + shell: bash run: | - python -m pip install --upgrade pip - pip install ./*.whl - pip install pytest + pip install dist/*.whl - name: Test with pytest run: |