simp-test 0.2.7 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccb769727351c7642097dcfcd4e54ca1dd3d5423117d34c48d8387ba254e64d4
4
- data.tar.gz: ff206eb86e90069cecfdaa1eabd1d9aea59d38717ac8cf1fc1e19e04f05a8b35
3
+ metadata.gz: b9487aa15fe2637c98a02a33941d7b9c1201b3ee2350cb6b0d6f8a3d73b03ea1
4
+ data.tar.gz: 423dfbd08bd5e74cad21f0bae8a8547955650ff1032b2353906ea5b21450c6ca
5
5
  SHA512:
6
- metadata.gz: 38f3fc3380a0640cc7e2aee3d0e7fb6725ec1dbebb80902c6149dea07e1f216c28d58513e912d4132f43906896cd23db87ba618e1435fb96442ea2f2f42756c6
7
- data.tar.gz: d41622abd737631923d36e2542e1a42bca4ba4b0bcbe7a49087a228aad5e66a55819047887eccab7adc401a303ce2cd55e38e61dfe8e16aedc570b44ad19603e
6
+ metadata.gz: 6dc2e7f81f6f8f1ecbd55fe0498a246fbdbca9836b2b89057a73c148837019f63ba41a9a7090d44d7369b0bf263350685e8dfa7d894c8ee145b8ddb1e919b4fb
7
+ data.tar.gz: 54fa02608b2eb5c2845315740dd425486514d36e80339d1b5f6678adccb43d7721b2f4ba48d3019e4fdb1dc64a49e338baf2be41aeb23a829ac3008333965126
@@ -0,0 +1,5 @@
1
+ {
2
+ "gem_build_command": "bundle exec rake pkg:gem",
3
+ "gem_release_command": "gem push dist/*.gem",
4
+ "gem_pkg_dir": "dist"
5
+ }
@@ -74,15 +74,15 @@ jobs:
74
74
  GEM_PKG_DIR='pkg'
75
75
  if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
76
76
  grep -w '"gem_pkg_dir"' &> /dev/null; then
77
- GEM_PKG_DIR="$(jq .gem_pkg_dir "$LOCAL_WORKFLOW_CONFIG_FILE" )"
77
+ GEM_PKG_DIR="$(jq -r .gem_pkg_dir "$LOCAL_WORKFLOW_CONFIG_FILE" )"
78
78
  fi
79
79
  if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
80
80
  grep -w '"gem_build_command"' &> /dev/null; then
81
- GEM_BUILD_COMMAND="$(jq .gem_build_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
81
+ GEM_BUILD_COMMAND="$(jq -r .gem_build_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
82
82
  fi
83
83
  if jq -r '. | keys' "$LOCAL_WORKFLOW_CONFIG_FILE" 2>/dev/null | \
84
84
  grep -w '"gem_release_command"' &> /dev/null; then
85
- GEM_RELEASE_COMMAND="$(jq .gem_release_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
85
+ GEM_RELEASE_COMMAND="$(jq -r .gem_release_command "$LOCAL_WORKFLOW_CONFIG_FILE" )"
86
86
  fi
87
87
  echo "::set-output name=build_command::${GEM_BUILD_COMMAND}"
88
88
  echo "::set-output name=pkg_dir::${GEM_PKG_DIR}"
@@ -92,11 +92,21 @@ jobs:
92
92
  ruby-version: 2.5
93
93
  bundler-cache: true
94
94
  - name: Test build the package
95
- run: "${{ steps.commands.outputs.build_command }}"
95
+ env:
96
+ GEM_BUILD_COMMAND: ${{ steps.commands.outputs.build_command }}
97
+ run: "$GEM_BUILD_COMMAND"
96
98
  - name: "Assert '${{ github.ref }}' matches the package version"
97
99
  run: |
98
100
  tag="${GITHUB_REF/refs\/tags\//}"
99
- [ -f ${{ steps.commands.outputs.pkg_dir }}/*-${tag}.gem ] || { echo "::error ::tag '${tag}' does not match package $(ls -1 ${{ steps.commands.outputs.pkg_dir }}/*.gem)"; exit 1 ; }
101
+ ls -lart
102
+ ls -lart ${{ steps.commands.outputs.pkg_dir }}
103
+ ls -lart ${{ steps.commands.outputs.pkg_dir }}/*.gem
104
+ [ -d "${{ steps.commands.outputs.pkg_dir }}" ] || \
105
+ { echo "::error ::No directory found at ${{ steps.commands.outputs.pkg_dir }}/" ; exit 3 ; }
106
+ ls -1 "${{ steps.commands.outputs.pkg_dir }}"/*.gem || \
107
+ { echo "::error ::No gem file found at ${{ steps.commands.outputs.pkg_dir }}/*.gem" ; exit 2 ; }
108
+ [ -f "${{ steps.commands.outputs.pkg_dir }}"/*-${tag}.gem ] || \
109
+ { echo "::error ::tag '${tag}' does not match package $(ls -1 ${{ steps.commands.outputs.pkg_dir }}/*.gem)"; exit 1 ; }
100
110
 
101
111
  create-github-release:
102
112
  name: Deploy GitHub Release
data/Rakefile CHANGED
@@ -1,8 +1,145 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
1
+ require 'rake/clean'
2
+ require 'fileutils'
3
+ require 'find'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
6
+ @package='simp-test'
7
+ @rakefile_dir=File.dirname(__FILE__)
8
+
9
+ CLEAN.include "#{@package}-*.gem"
10
+ CLEAN.include 'pkg'
11
+ CLEAN.include 'dist'
12
+ CLEAN.include '.vendor'
13
+ Find.find( @rakefile_dir ) do |path|
14
+ if File.directory? path
15
+ CLEAN.include path if File.basename(path) == 'tmp'
16
+ else
17
+ Find.prune
18
+ end
19
+ end
20
+
21
+
22
+ desc 'Ensure gemspec-safe permissions on all files'
23
+ task :chmod do
24
+ gemspec = File.expand_path( "#{@package}.gemspec", @rakefile_dir ).strip
25
+ spec = Gem::Specification::load( gemspec )
26
+ spec.files.each do |file|
27
+ FileUtils.chmod 'go=r', file unless File.symlink?(file)
28
+ end
29
+ end
30
+
31
+ desc 'special notes about these rake commands'
32
+ task :help do
33
+ puts %Q{
34
+ == environment variables ==
35
+ SIMP_RPM_BUILD when set, alters the gem produced by pkg:gem to be RPM-safe.
36
+ 'pkg:gem' sets this automatically.
37
+ }
38
+ end
39
+
40
+ desc "Run spec tests"
41
+ RSpec::Core::RakeTask.new(:spec) do |t|
42
+ t.rspec_opts = ['--color']
43
+ t.pattern = 'spec/lib/**/*_spec.rb'
44
+ end
45
+
46
+ desc %q{run all RSpec tests (alias of 'spec')}
47
+ task :test => :spec
48
+
49
+ desc "Run acceptance tests"
50
+ RSpec::Core::RakeTask.new(:acceptance) do |t|
51
+ t.pattern = 'spec/acceptance'
52
+ end
53
+
54
+ namespace :pkg do
55
+ @specfile_template = "rubygem-#{@package}.spec.template"
56
+ @specfile = "build/rubygem-#{@package}.spec"
57
+
58
+ # ----------------------------------------
59
+ # DO NOT UNCOMMENT THIS: the spec file requires a lot of tweaking
60
+ # ----------------------------------------
61
+ # desc "generate RPM spec file for #{@package}"
62
+ # task :spec => [:clean, :gem] do
63
+ # Dir.glob("pkg/#{@package}*.gem") do |pkg|
64
+ # sh %Q{gem2rpm -t "#{@specfile_template}" "#{pkg}" > "#{@specfile}"}
65
+ # end
66
+ # end
67
+
68
+ desc "build rubygem package for #{@package}"
69
+ task :gem => :chmod do
70
+ Dir.chdir @rakefile_dir
71
+ Dir['*.gemspec'].each do |spec_file|
72
+ rpm_build = ENV.fetch('SIMP_RPM_BUILD', '1')
73
+ cmd = %Q{SIMP_RPM_BUILD=#{rpm_build} bundle exec gem build "#{spec_file}"}
74
+ sh cmd
75
+ FileUtils.mkdir_p 'dist'
76
+ FileUtils.mv Dir.glob("#{@package}*.gem"), 'dist/'
77
+ end
78
+ end
79
+
80
+
81
+ desc "build and install rubygem package for #{@package}"
82
+ task :install_gem => [:clean, :gem] do
83
+ Dir.chdir @rakefile_dir
84
+ Dir.glob("dist/#{@package}*.gem") do |pkg|
85
+ sh %Q{bundle exec gem install #{pkg}}
86
+ end
87
+ end
88
+
89
+
90
+ desc "generate RPM for #{@package}"
91
+ require 'tmpdir'
92
+ task :rpm, [:mock_root] => [:clean, :gem] do |t, args|
93
+ mock_root = args[:mock_root]
94
+ # TODO : Get rid of this terrible code. Shoe-horned in until
95
+ # we have a better idea for auto-decet
96
+ if mock_root =~ /^epel-6/ then el_version = '6'
97
+ elsif mock_root =~ /^epel-7/ then el_version = '7'
98
+ else puts 'WARNING: Did not detect epel version'
99
+ end
100
+ tmp_dir = ''
101
+
102
+ if tmp_dir = ENV.fetch( 'SIMP_MOCK_SIMPGEM_ASSETS_DIR', false )
103
+ FileUtils.mkdir_p tmp_dir
104
+ else
105
+ tmp_dir = Dir.mktmpdir( "build_#{@package}" )
106
+ end
107
+
108
+ begin
109
+ Dir.chdir tmp_dir
110
+ specfile = "#{@rakefile_dir}/build/rubygem-#{@package}.el#{el_version}.spec"
111
+ tmp_specfile = "#{tmp_dir}/rubygem-#{@package}.el#{el_version}.spec"
112
+
113
+ # We have to copy to a local directory because mock bugs out in NFS
114
+ # home directories (where SIMP devs often work)
115
+ FileUtils.cp specfile, tmp_specfile, :preserve => true
116
+ Dir.glob("#{@rakefile_dir}/dist/#{@package}*.gem") do |pkg|
117
+ FileUtils.cp pkg, tmp_dir, :preserve => true
118
+ end
119
+
120
+ # Build SRPM from specfile
121
+ sh %Q{mock -r #{mock_root} --buildsrpm --source="#{tmp_dir}" --spec="#{tmp_specfile}" --resultdir="#{tmp_dir}"}
122
+
123
+ # Build RPM from SRPM
124
+ Dir.glob("#{tmp_dir}/rubygem-#{@package}-*.el#{el_version}*.src.rpm") do |pkg|
125
+ sh %Q{mock -r #{mock_root} --rebuild "#{pkg}" --resultdir=#{tmp_dir} --no-cleanup-after}
126
+ end
127
+
128
+ sh %Q{ls -l "#{tmp_dir}"}
129
+
130
+ # copy RPM back into pkg/
131
+ Dir.glob("#{tmp_dir}/rubygem-#{@package}-*.el#{el_version}*.rpm") do |pkg|
132
+ sh %Q{cp "#{pkg}" "#{@rakefile_dir}/dist/"}
133
+ FileUtils.cp pkg, "#{@rakefile_dir}/dist/"
134
+ end
135
+ ensure
136
+ Dir.chdir @rakefile_dir
137
+ # cleanup if needed
138
+ if ! ENV.fetch( 'SIMP_MOCK_SIMPGEM_ASSETS_DIR', false )
139
+ FileUtils.remove_entry_secure tmp_dir
140
+ end
141
+ end
142
+ end
143
+ end
7
144
 
8
- task default: :spec
145
+ # vim: syntax=ruby
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Simp
4
4
  module Test
5
- VERSION = '0.2.7'
5
+ VERSION = '0.3.19'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - SIMP Team
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".github/workflows.local.json"
20
21
  - ".github/workflows/pr_glci.yml"
21
22
  - ".github/workflows/pr_glci_cleanup.yml"
22
23
  - ".github/workflows/pr_glci_manual.yml"