Compare commits
3 Commits
main
...
issue/2110
| Author | SHA1 | Date |
|---|---|---|
|
|
ead34158a6 | |
|
|
d68675eac4 | |
|
|
2b92716afb |
|
|
@ -6,11 +6,30 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
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:
|
test:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
needs: [ split ]
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
ruby-version: ['2.7', '3.0', '3.1', '3.4']
|
ruby-version: ['2.7', '3.0', '3.1', '3.4']
|
||||||
|
rspec-group: ${{ fromJSON(needs.split.outputs.rspec_groups) }}
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
@ -21,10 +40,7 @@ jobs:
|
||||||
ruby-version: ${{ matrix.ruby-version }}
|
ruby-version: ${{ matrix.ruby-version }}
|
||||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||||
- run: |
|
- run: |
|
||||||
if [ ! -z "$RUNNER_DEBUG" ] ; then
|
[ ! -z "$RUNNER_DEBUG" ] && export DEBUG=1
|
||||||
DEBUG=1 bundle exec rspec -fd
|
bundle exec rspec -fd -e "${{ matrix.rspec-group }}"
|
||||||
else
|
|
||||||
bundle exec rspec
|
|
||||||
fi
|
|
||||||
env:
|
env:
|
||||||
SHELL: /usr/bin/bash
|
SHELL: /usr/bin/bash
|
||||||
|
|
|
||||||
|
|
@ -375,11 +375,15 @@ class FPM::Package::Python < FPM::Package
|
||||||
|
|
||||||
logger.info("Setting default python executable", :name => default_python)
|
logger.info("Setting default python executable", :name => default_python)
|
||||||
attributes[:python_bin] = default_python
|
attributes[:python_bin] = default_python
|
||||||
|
end
|
||||||
|
|
||||||
if !attributes[:python_package_name_prefix_given?]
|
if !attributes[:python_package_name_prefix_given?]
|
||||||
attributes[:python_package_name_prefix] = default_python
|
major = nil
|
||||||
logger.info("Setting package name prefix", :name => default_python)
|
execmd([attributes[:python_bin], "-c", "import sys; print(sys.version_info[0])"], :stdin => false, :stderr => false) do |stdout|
|
||||||
|
major = stdout.readline.chomp
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
if attributes[:python_internal_pip?]
|
if attributes[:python_internal_pip?]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
module FPM
|
module FPM
|
||||||
VERSION = "1.17.0.pre1"
|
VERSION = "1.17.0"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ describe FPM::Package::Python do
|
||||||
#subject.attributes[:python_bin] = find_python
|
#subject.attributes[:python_bin] = find_python
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
let(:python_major) do
|
||||||
|
`#{subject.attributes[:python_bin]} -c "import sys; print(sys.version_info[0])"`.chomp
|
||||||
|
end
|
||||||
|
|
||||||
let (:example_dir) do
|
let (:example_dir) do
|
||||||
File.expand_path("../../fixtures/python/", File.dirname(__FILE__))
|
File.expand_path("../../fixtures/python/", File.dirname(__FILE__))
|
||||||
end
|
end
|
||||||
|
|
@ -56,9 +61,11 @@ describe FPM::Package::Python do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "and :python_package_name_prefix is nil/default" do
|
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)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -99,7 +106,7 @@ describe FPM::Package::Python do
|
||||||
it "should prefix the package based on the version of python" do
|
it "should prefix the package based on the version of python" do
|
||||||
subject.input(example_dir)
|
subject.input(example_dir)
|
||||||
insist { subject.attributes[:python_package_name_prefix_given?] }.nil?
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue