Compare commits

...

3 Commits

Author SHA1 Message Date
Jordan Sissel ead34158a6 Github Actions: shard rspec by top-level description.
This is done by doing `rspec -fd --dry-run` and selecting only top-level descriptions
Then feeding that into a matrix setting.

Hopefully this will make testing faster/easier to debug when there are flakey tests.
2025-10-02 17:31:51 -07:00
Jordan Sissel d68675eac4 Change default --python-package-name-prefix to be based on the python version major which will most likely be 3
For #2110
2025-10-02 16:22:06 -07:00
Jordan Sissel 2b92716afb v1.17.0 :) 2025-10-02 12:49:12 -07:00
4 changed files with 39 additions and 12 deletions

View File

@ -6,11 +6,30 @@ on:
branches: [main]
jobs:
split:
runs-on: ubuntu-24.04
outputs:
rspec_groups: ${{ steps.groups.outputs.rspec_groups }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- id: groups
run: |
printf "rspec_groups<<JSON\n" >> $GITHUB_OUTPUT
bundle exec rspec -fd --dry-run | sed -ne '/^Finished in /q; /^\S/p' | jq -R | jq -s >> $GITHUB_OUTPUT
printf "JSON\n" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-22.04
needs: [ split ]
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.4']
rspec-group: ${{ fromJSON(needs.split.outputs.rspec_groups) }}
steps:
- run: |
sudo apt-get update
@ -21,10 +40,7 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: |
if [ ! -z "$RUNNER_DEBUG" ] ; then
DEBUG=1 bundle exec rspec -fd
else
bundle exec rspec
fi
[ ! -z "$RUNNER_DEBUG" ] && export DEBUG=1
bundle exec rspec -fd -e "${{ matrix.rspec-group }}"
env:
SHELL: /usr/bin/bash

View File

@ -375,11 +375,15 @@ class FPM::Package::Python < FPM::Package
logger.info("Setting default python executable", :name => default_python)
attributes[:python_bin] = default_python
end
if !attributes[:python_package_name_prefix_given?]
attributes[:python_package_name_prefix] = default_python
logger.info("Setting package name prefix", :name => default_python)
major = nil
execmd([attributes[:python_bin], "-c", "import sys; print(sys.version_info[0])"], :stdin => false, :stderr => false) do |stdout|
major = stdout.readline.chomp
end
attributes[:python_package_name_prefix] = "python#{major}"
logger.info("Setting package name prefix based on python major version #{major}", :name => attributes[:python_package_name_prefix])
end
if attributes[:python_internal_pip?]

View File

@ -1,3 +1,3 @@
module FPM
VERSION = "1.17.0.pre1"
VERSION = "1.17.0"
end

View File

@ -38,6 +38,11 @@ describe FPM::Package::Python do
#subject.attributes[:python_bin] = find_python
end
let(:python_major) do
`#{subject.attributes[:python_bin]} -c "import sys; print(sys.version_info[0])"`.chomp
end
let (:example_dir) do
File.expand_path("../../fixtures/python/", File.dirname(__FILE__))
end
@ -56,9 +61,11 @@ describe FPM::Package::Python do
end
context "and :python_package_name_prefix is nil/default" do
it "should prefix the package name based on detected python-bin name" do
it "should prefix the package name based on detected python-bin version" do
subject.input(example_dir)
insist { subject.name } == "#{subject.attributes[:python_bin]}-Example"
reject { subject.attributes[:python_package_name_prefix_given?] }
insist { subject.attributes[:python_package_name_prefix] } == "python#{python_major}"
insist { subject.name } == "python#{python_major}-Example"
end
end
@ -99,7 +106,7 @@ describe FPM::Package::Python do
it "should prefix the package based on the version of python" do
subject.input(example_dir)
insist { subject.attributes[:python_package_name_prefix_given?] }.nil?
insist { subject.name } == "#{subject.attributes[:python_bin]}-example"
insist { subject.name } == "python#{python_major}-example"
end
end