Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken venv python use on Windows #265

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 46 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ jobs:
with:
python-version-file: ".python-version"

- name: Set Python executable path based on OS
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "VENV_PYTHON=venv\\Scripts\\python" >> $GITHUB_ENV
else
echo "VENV_PYTHON=venv/bin/python3" >> $GITHUB_ENV
fi

- name: Install Python dependencies
shell: bash
run: |
python3 -m venv --upgrade-deps venv
venv/bin/python3 -m pip install --upgrade pip wheel
venv/bin/python3 -m pip install --require-hashes -r requirements.txt
$VENV_PYTHON -m pip install --upgrade pip wheel
$VENV_PYTHON -m pip install --require-hashes -r requirements.txt

- name: Clone Artichoke
uses: actions/[email protected]
Expand Down Expand Up @@ -60,8 +70,12 @@ jobs:
run: cargo build --verbose --release

- name: GPG sign binary
shell: bash
id: gpg_signing
run: venv/bin/python3 -m artichoke_nightly.gpg_sign "nightly-gpg-sign-test" --artifact artichoke/target/release/artichoke
run: |
$VENV_PYTHON -m artichoke_nightly.gpg_sign \
"nightly-gpg-sign-test" \
--artifact artichoke/target/release/artichoke

- name: Verify GPG signature
run: gpg --batch --verify "${{ steps.gpg_signing.outputs.signature }}" artichoke/target/release/artichoke
Expand All @@ -78,11 +92,21 @@ jobs:
with:
python-version-file: ".python-version"

- name: Set Python executable path based on OS
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "VENV_PYTHON=venv\\Scripts\\python" >> $GITHUB_ENV
else
echo "VENV_PYTHON=venv/bin/python3" >> $GITHUB_ENV
fi

- name: Install Python dependencies
shell: bash
run: |
python3 -m venv --upgrade-deps venv
venv/bin/python3 -m pip install --upgrade pip wheel
venv/bin/python3 -m pip install --require-hashes -r requirements.txt
$VENV_PYTHON -m pip install --upgrade pip wheel
$VENV_PYTHON -m pip install --require-hashes -r requirements.txt

- name: Clone Artichoke
uses: actions/[email protected]
Expand All @@ -97,10 +121,11 @@ jobs:
# This will codesign binaries in place which means that the tarballed
# binaries will be codesigned as well.
- name: Run Apple Codesigning and Notarization
shell: bash
id: apple_codesigning
if: runner.os == 'macOS'
run: |
venv/bin/python3 -m artichoke_nightly.macos_sign_and_notarize "nightly-apple-codesign-test" \
$VENV_PYTHON -m artichoke_nightly.macos_sign_and_notarize "nightly-apple-codesign-test" \
--binary "artichoke/target/release/artichoke" \
--binary "artichoke/target/release/airb" \
--resource artichoke/LICENSE \
Expand Down Expand Up @@ -131,20 +156,30 @@ jobs:
with:
python-version-file: ".python-version"

- name: Set Python executable path based on OS
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "VENV_PYTHON=venv\\Scripts\\python" >> $GITHUB_ENV
else
echo "VENV_PYTHON=venv/bin/python3" >> $GITHUB_ENV
fi

- name: Install Python dependencies
shell: bash
run: |
python3 -m venv --upgrade-deps venv
venv/bin/python3 -m pip install --upgrade pip wheel
venv/bin/python3 -m pip install --require-hashes -r requirements.txt -r dev-requirements.txt
$VENV_PYTHON -m pip install --upgrade pip wheel
$VENV_PYTHON -m pip install --require-hashes -r dev-requirements.txt

- name: Run black
run: venv/bin/black --check --diff --verbose .
run: $VENV_PYTHON -m black --check --diff --verbose .

- name: Run ruff
run: venv/bin/ruff check --output-format=github .
run: $VENV_PYTHON -m ruff check --output-format=github .

- name: Run mypy
run: venv/bin/mypy .
run: $VENV_PYTHON -m mypy .

ruby:
name: Lint and format Ruby
Expand Down
71 changes: 49 additions & 22 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,26 @@ jobs:
with:
python-version-file: ".python-version"

- name: Set Python executable path based on OS
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "VENV_PYTHON=venv\\Scripts\\python" >> $GITHUB_ENV
else
echo "VENV_PYTHON=venv/bin/python3" >> $GITHUB_ENV
fi

- name: Install Python dependencies
shell: bash
run: |
python3 -m venv --upgrade-deps venv
$VENV_PYTHON -m pip install --upgrade pip wheel
$VENV_PYTHON -m pip install --require-hashes -r requirements.txt

- name: Set Artichoke Rust toolchain version
shell: python
id: rust_toolchain
working-directory: artichoke
shell: python
run: |
import os
import tomllib
Expand All @@ -194,11 +210,6 @@ jobs:
toolchain: ${{ steps.rust_toolchain.outputs.version }}
target: ${{ matrix.target }}

- name: Setup Python
uses: actions/[email protected]
with:
python-version-file: ".python-version"

# ```
# $ gpg --fingerprint --with-subkey-fingerprints [email protected]
# pub ed25519 2021-01-03 [SC]
Expand Down Expand Up @@ -240,19 +251,15 @@ jobs:
working-directory: artichoke
run: cargo build --verbose --release --target ${{ matrix.target }}

- name: Install Python dependencies
run: |
python3 -m venv --upgrade-deps venv
venv/bin/python3 -m pip install --upgrade pip wheel
venv/bin/python3 -m pip install --require-hashes -r requirements.txt

# This will codesign binaries in place which means that the tarballed
# binaries will be codesigned as well.
- name: Run Apple Codesigning and Notarization
shell: bash
id: apple_codesigning
if: runner.os == 'macOS'
run: |
venv/bin/python3 -m artichoke_nightly.macos_sign_and_notarize "artichoke-nightly-${{ matrix.target }}" \
$VENV_PYTHON -m artichoke_nightly.macos_sign_and_notarize \
"artichoke-nightly-${{ matrix.target }}" \
--binary "artichoke/target/${{ matrix.target }}/release/artichoke" \
--binary "artichoke/target/${{ matrix.target }}/release/airb" \
--resource artichoke/LICENSE \
Expand All @@ -265,10 +272,12 @@ jobs:
MACOS_CERTIFICATE_PASSPHRASE: ${{ secrets.MACOS_CERTIFICATE_PASSPHRASE }}

- name: GPG sign Apple DMG
shell: bash
id: apple_codesigning_gpg
if: runner.os == 'macOS'
run: |
venv/bin/python3 -m artichoke_nightly.gpg_sign "artichoke-nightly-${{ matrix.target }}" \
$VENV_PYTHON -m artichoke_nightly.gpg_sign \
"artichoke-nightly-${{ matrix.target }}" \
--artifact "${{ steps.apple_codesigning.outputs.asset }}"

- name: Upload release archive
Expand Down Expand Up @@ -321,8 +330,12 @@ jobs:
fi

- name: GPG sign archive
shell: bash
id: gpg_signing
run: venv/bin/python3 -m artichoke_nightly.gpg_sign "artichoke-nightly-${{ matrix.target }}" --artifact "${{ steps.build.outputs.asset }}"
run: |
$VENV_PYTHON -m artichoke_nightly.gpg_sign \
"artichoke-nightly-${{ matrix.target }}" \
--artifact "${{ steps.build.outputs.asset }}"

- name: Upload release archive
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
Expand Down Expand Up @@ -400,6 +413,22 @@ jobs:
with:
python-version-file: ".python-version"

- name: Set Python executable path based on OS
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
echo "VENV_PYTHON=venv\\Scripts\\python" >> $GITHUB_ENV
else
echo "VENV_PYTHON=venv/bin/python3" >> $GITHUB_ENV
fi

- name: Install Python dependencies
shell: bash
run: |
python3 -m venv --upgrade-deps venv
$VENV_PYTHON -m pip install --upgrade pip wheel
$VENV_PYTHON -m pip install --require-hashes -r requirements.txt

# ```
# $ gpg --fingerprint --with-subkey-fingerprints [email protected]
# pub ed25519 2021-01-03 [SC]
Expand Down Expand Up @@ -429,12 +458,6 @@ jobs:
--output=`pwd`/artichoke-nightly.source.${{ matrix.archive }} \
${{ steps.release_info.outputs.commit }}

- name: Install Python dependencies
run: |
python3 -m venv --upgrade-deps venv
venv/bin/python3 -m pip install --upgrade pip wheel
venv/bin/python3 -m pip install --require-hashes -r requirements.txt

- name: Build archive
shell: bash
id: build
Expand All @@ -448,8 +471,12 @@ jobs:
fi

- name: GPG sign archive
shell: bash
id: gpg_signing
run: venv/bin/python3 -m artichoke_nightly.gpg_sign "artichoke-nightly-${{ matrix.target }}" --artifact "${{ steps.build.outputs.asset }}"
run: |
$VENV_PYTHON -m artichoke_nightly.gpg_sign \
"artichoke-nightly-source-archive" \
--artifact "${{ steps.build.outputs.asset }}"

- name: Upload release archive
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
Expand Down