diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 527dfb05..95e8390d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -49,20 +49,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Fetch all tags fetch-depth: 0 - - name: Install build dependencies - run: python -m pip install --upgrade build wheel setuptools cython mypy + - name: Install Hatch + run: pip install --upgrade hatch hatch-pip-compile - name: Build - run: python -m build + run: hatch build - uses: actions/upload-artifact@v4 with: - name: artifacts + name: wheels path: dist/* if-no-files-found: error overwrite: true @@ -70,23 +70,26 @@ jobs: build-binaries: name: Build binary application for ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} + needs: + - collection-scripts + - pure-python-wheel-and-sdist strategy: fail-fast: false matrix: job: # Linux - target: x86_64-unknown-linux-gnu - os: ubuntu-22.04 - cross: true - - target: x86_64-unknown-linux-musl - os: ubuntu-22.04 - cross: true - - target: aarch64-unknown-linux-gnu - os: ubuntu-22.04 - cross: true - - target: i686-unknown-linux-gnu - os: ubuntu-22.04 - cross: true + os: ubuntu-latest + cross: false + # - target: x86_64-unknown-linux-musl + # os: ubuntu-latest + # cross: false + # - target: aarch64-unknown-linux-gnu + # os: ubuntu-latest + # cross: false + # - target: i686-unknown-linux-gnu + # os: ubuntu-latest + # cross: false # Windows - target: x86_64-pc-windows-msvc os: windows-2022 @@ -102,12 +105,21 @@ jobs: CARGO: cargo CARGO_BUILD_TARGET: ${{ matrix.job.target }} PYAPP_REPO: pyapp - PYAPP_VERSION: v0.16.0 + PYAPP_VERSION: v0.18.0 PYAPP_PROJECT_FEATURES: oracle,postgres,mssql,mysql,server,remote PYAPP_DISTRIBUTION_EMBED: "1" + PYAPP_UV_ENABLED: "1" + HATCH_BUILD_LOCATION: dist steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + # Fetch all tags + fetch-depth: 0 + + - name: Install musl-tools on Linux + run: sudo apt-get install --yes musl musl-dev musl-tools + if: ${{ matrix.job.os == 'Linux' }} - name: Clone PyApp run: git clone --depth 1 --branch $PYAPP_VERSION https://github.com/ofek/pyapp $PYAPP_REPO @@ -120,8 +132,8 @@ jobs: - name: Install Hatch run: pip install -U hatch hatch-pip-compile - - name: Install Rust toolchain + if: ${{ !matrix.job.cross }} uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.job.target }} @@ -145,20 +157,25 @@ jobs: cargo -V hatch --version + - uses: actions/download-artifact@v4 + with: + name: wheels + path: ${{ github.workspace }}/dist + merge-multiple: true + + - name: Build Binary - working-directory: /home/runner/work/database-assessment/database-assessment/ + working-directory: ${{ github.workspace }} run: |- current_version=$(hatch version) - hatch build - PYAPP_UV_ENABLED="1" PYAPP_PROJECT_PATH="$(ls ${PWD}/dist/dma-${current_version}-py3-none-any.whl)" PYAPP_PROJECT_FEATURES="oracle,postgres,mssql,mysql,server,remote" PYAPP_DISTRIBUTION_EMBED="1" hatch build -t app + PYAPP_PROJECT_PATH="${{ github.workspace }}/dist/dma-${current_version}-py3-none-any.whl" PYAPP_PROJECT_FEATURES="oracle,postgres,mssql,mysql,server,remote" PYAPP_DISTRIBUTION_EMBED="1" hatch -v build -t app - name: Upload built binary package uses: actions/upload-artifact@v4 with: - name: binaries + name: binaries-${{ env.CARGO_BUILD_TARGET }} path: dist/app/* if-no-files-found: error - overwrite: true publish: name: Publish release @@ -171,13 +188,6 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: collections - path: dist - merge-multiple: true - - - uses: actions/download-artifact@v4 - with: - name: artifacts path: dist merge-multiple: true @@ -187,15 +197,7 @@ jobs: # skip_existing: true # user: __token__ # password: ${{ secrets.PYPI_API_TOKEN }} - - - uses: actions/download-artifact@v4 - with: - name: binaries - path: dist - merge-multiple: true - - - name: Add assets to current release + - name: Add assets to release uses: softprops/action-gh-release@v2 with: files: dist/* - merge-multiple: true diff --git a/pyproject.toml b/pyproject.toml index 2dc3f10c..f5c6339a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -133,9 +133,11 @@ sources = ["src"] [tool.hatch.build.targets.sdist] exclude = ["/.github", "/docs"] -[tool.hatch.build.targets.app] +[tool.hatch.build.targets.binary] +pyapp-version = "0.18.0" python = "3.12" + ##################### # Environment Setup # #####################