diff --git a/.github/actions/build-package/action.yml b/.github/actions/build-package/action.yml index 1f016d5..83093c9 100644 --- a/.github/actions/build-package/action.yml +++ b/.github/actions/build-package/action.yml @@ -4,9 +4,6 @@ inputs: python-version: description: "Python version" required: true - target: - description: "Target to build the package for" - required: true runs: using: composite @@ -15,14 +12,28 @@ runs: - uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} + - name: Set target based on OS and arch + shell: bash + run: | + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "TARGET=x86_64-unknown-linux-gnu" >> $GITHUB_ENV + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_ARCH}" == "ARM64" ]]; then + echo "TARGET=aarch64-apple-darwin" >> $GITHUB_ENV + else + echo "TARGET=x86_64-apple-darwin" >> $GITHUB_ENV + fi + elif [[ "${RUNNER_OS}" == "Windows" ]]; then + echo "TARGET=x86_64-pc-windows-msvc" >> $GITHUB_ENV + fi - name: Build wheels uses: PyO3/maturin-action@v1 with: - target: ${{ inputs.target }} + target: ${{ steps.target.outputs.target }} args: --release --out dist --find-interpreter sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-${{ inputs.target }} + name: wheels-${{ steps.target.outputs.target }} path: dist diff --git a/.github/actions/build-worker/action.yml b/.github/actions/build-worker/action.yml index e3eb7b3..9f96795 100644 --- a/.github/actions/build-worker/action.yml +++ b/.github/actions/build-worker/action.yml @@ -4,9 +4,6 @@ inputs: python-version: description: "Python version to use" required: true - target: - description: "Target that is the worker is built for" - required: true runs: using: composite @@ -14,6 +11,21 @@ runs: - name: Checkout repository uses: actions/checkout@v4 + - name: Set target based on OS and arch + shell: bash + run: | + if [[ "${RUNNER_OS}" == "Linux" ]]; then + echo "TARGET=x86_64-unknown-linux-gnu" >> $GITHUB_ENV + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_ARCH}" == "ARM64" ]]; then + echo "TARGET=aarch64-apple-darwin" >> $GITHUB_ENV + else + echo "TARGET=x86_64-apple-darwin" >> $GITHUB_ENV + fi + elif [[ "${RUNNER_OS}" == "Windows" ]]; then + echo "TARGET=x86_64-pc-windows-msvc" >> $GITHUB_ENV + fi + - name: Set up Python ${{ inputs.python-version }} uses: actions/setup-python@v5 with: @@ -27,14 +39,14 @@ runs: - name: Build shell: bash -euxo pipefail {0} - run: scripts/build-worker.sh ${{ inputs.target }} + run: scripts/build-worker.sh ${{ steps.target.outputs.target }} - name: Package the worker (Linux) if: runner.os == 'Linux' shell: bash -euxo pipefail {0} run: | cd dist - mv fluxqueue-worker-${{ inputs.target }} fluxqueue-worker + mv fluxqueue-worker-${{ steps.target.outputs.target }} fluxqueue-worker tar -czvf fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-linux-x86_64.tar.gz fluxqueue-worker rm fluxqueue-worker @@ -43,21 +55,21 @@ runs: shell: bash -euxo pipefail {0} run: | cd dist - mv fluxqueue-worker-${{ inputs.target }} fluxqueue-worker - zip fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-${{ inputs.target }}.zip fluxqueue-worker + mv fluxqueue-worker-${{ steps.target.outputs.target }} fluxqueue-worker + zip fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-${{ steps.target.outputs.target }}.zip fluxqueue-worker rm fluxqueue-worker - name: Package the worker (Windows) if: runner.os == 'Windows' - shell: bash -euxo pipefail {0} + shell: pwsh run: | cd dist - mv fluxqueue-worker-${{ inputs.target }}.exe fluxqueue-worker.exe - zip fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-windows-x86_64.zip fluxqueue-worker.exe + mv fluxqueue-worker-${{ steps.target.outputs.target }}.exe fluxqueue-worker.exe + Compress-Archive -Path fluxqueue-worker.exe -DestinationPath fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-windows-x86_64.zip rm fluxqueue-worker.exe - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: fluxqueue-worker-${{ inputs.target }}-py${{ inputs.python-version }} + name: fluxqueue-worker-${{ steps.target.outputs.target }}-py${{ inputs.python-version }} path: dist/* diff --git a/.github/workflows/release-worker.yml b/.github/workflows/release-worker.yml index bab6879..83d54e9 100644 --- a/.github/workflows/release-worker.yml +++ b/.github/workflows/release-worker.yml @@ -22,16 +22,8 @@ jobs: name: ${{ matrix.os }} (Py ${{ matrix.python-version }}) strategy: matrix: + os: [ubuntu-latest, macos-15-arm64, macos-15-intel, windows-latest] python-version: ["3.11", "3.12", "3.13", "3.14"] - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - - os: macos-15-intel - target: x86_64-apple-darwin - - os: macos-latest - target: aarch64-apple-darwin - - os: windows-latest - target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -39,7 +31,6 @@ jobs: uses: ./.github/actions/build-worker with: python-version: ${{ matrix.python-version }} - target: ${{ matrix.target }} release: if: github.repository_owner == 'ccxlv' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1901d77..d61144e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,8 +34,8 @@ jobs: strategy: fail-fast: false matrix: + os: [ubuntu-latest, macos-latest, macos-15-intel] python-version: ["3.11", "3.12", "3.13", "3.14"] - os: [ubuntu-latest, macos-15-intel, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4