-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
194 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,58 @@ | ||
name: noop run | ||
|
||
on: | ||
workflow_dispatch: {} | ||
pull_request: {} | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit: | ||
runs-on: ubuntu-latest | ||
name: Run msync --noop against all modules | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
bundler-cache: true | ||
- name: Run msync --noop | ||
run: bundle exec msync update --noop --git-base=https://github.com/ | ||
run: bundle exec msync update --noop --git-base=https://github.com/ --branch foobranch | ||
metadata_json_deps: | ||
runs-on: ubuntu-latest | ||
name: Run metadata_json_deps on all modules | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
bundler-cache: true | ||
- name: Run msync --noop | ||
run: bundle exec msync clone --git-base=https://github.com/ | ||
- run: bundle exec rake metadata_deps | ||
outdated_module_summary: | ||
runs-on: ubuntu-latest | ||
name: Prints a list of all modules with outdated modulesync_config version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
bundler-cache: true | ||
- name: Run msync --noop | ||
run: bundle exec msync clone --git-base=https://github.com/ | ||
- name: Generate summary | ||
run: bundle exec bin/outdated_modules_and_their_version | ||
|
||
tests: | ||
needs: | ||
- unit | ||
- metadata_json_deps | ||
runs-on: ubuntu-latest | ||
name: Test suite | ||
steps: | ||
- run: echo Test suite completed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
# frozen_string_literal: true | ||
# Copyright 2016 Vox Pupuli | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
source 'https://rubygems.org' | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
|
||
gem 'github_changelog_generator' | ||
gem 'modulesync' | ||
gem 'rake' | ||
gem 'rubocop' | ||
group :development do | ||
gem 'pry' | ||
end | ||
|
||
group :release do | ||
gem 'faraday-retry', '~> 2.1', require: false | ||
gem 'github_changelog_generator', '~> 1.16.4', require: false | ||
end | ||
|
||
gem 'puppet_forge', '>= 2.2.9' | ||
gem 'metadata_json_deps', '>= 0.2.0', '< 2' | ||
gem 'modulesync', '>= 2.6.0' | ||
gem "octokit", "~> 4.0" | ||
# vim: syntax=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,21 @@ | ||
# frozen_string_literal: true | ||
require 'metadata_json_deps' | ||
|
||
require 'erb' | ||
require 'find' | ||
require 'open3' | ||
require 'rubocop/rake_task' | ||
require 'yaml' | ||
|
||
def project_files(*suffixes, &block) | ||
Find.find(*Dir['*']) do |path| | ||
if FileTest.directory?(path) | ||
Find.prune if %w[modules vendor].include?(path) | ||
elsif suffixes.map { |x| path.end_with?(x) }.any? | ||
block.call(path) | ||
end | ||
end | ||
end | ||
|
||
RuboCop::RakeTask.new | ||
|
||
desc 'Check syntax of various files' | ||
task default: %i[erb rubocop yml] | ||
|
||
task :erb do | ||
puts '===> Checking ERB files syntax…' | ||
project_files('.erb') do |file| | ||
puts file | ||
erb = File.read(file) | ||
code = ERB.new(erb, trim_mode: '-').src | ||
Open3.popen2e('ruby -c') do |stdin, stdout_and_stderr, wait_thr| | ||
stdin.puts(code) | ||
stdin.close | ||
|
||
exit_status = wait_thr.value | ||
abort(stdout_and_stderr.read) unless exit_status.success? | ||
|
||
stdout_and_stderr.close | ||
end | ||
end | ||
desc 'Run metadata-json-deps' | ||
task :metadata_deps do | ||
files = FileList['modules/*/*/metadata.json'] | ||
MetadataJsonDeps.run(files) | ||
end | ||
|
||
task :yml do | ||
puts '===> Checking YAML files syntax…' | ||
project_files('.yml', '.yaml') do |file| | ||
puts file | ||
begin | ||
require 'github_changelog_generator/task' | ||
require 'yaml' | ||
|
||
begin | ||
YAML.load_file(file) | ||
rescue Psych::SyntaxError => e | ||
abort(e.message) | ||
end | ||
GitHubChangelogGenerator::RakeTask.new :changelog do |config| | ||
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file." | ||
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog github_actions} | ||
config.user = 'voxpupuli' | ||
config.project = 'modulesync_config' | ||
config.future_release = YAML.safe_load(File.read('moduleroot/.msync.yml.erb'))['modulesync_config_version'] | ||
end | ||
end | ||
|
||
require 'github_changelog_generator/task' | ||
|
||
GitHubChangelogGenerator::RakeTask.new :changelog do |config| | ||
config.user = 'opus-codium' | ||
config.project = 'modulesync_config' | ||
config.future_release = '2.4.0' | ||
config.unreleased = true | ||
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog ignore] | ||
rescue LoadError | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'yaml' | ||
require 'erb' | ||
|
||
# the current version in modulesync_config | ||
version = YAML.load(ERB.new(File.read('moduleroot/.msync.yml.erb')).result)['modulesync_config_version'] | ||
|
||
mod_ary = [] | ||
# min width is width of String "Module" | ||
width_modules = 6 | ||
# min width is width of String "modulesync_config version" | ||
width_version = 25 | ||
Dir.glob('modules/voxpupuli/puppet-*').sort.each do |f| | ||
if File.exists?(f + '/.msync.yml') | ||
version_module = YAML.load_file(f + '/.msync.yml')['modulesync_config_version'] | ||
mod = (f).split('/')[2] | ||
if version != version_module | ||
mod_ary.push([mod, version_module]) | ||
width_modules = [width_modules, mod.length].max | ||
width_version = [width_version, version_module.length].max | ||
end | ||
else | ||
version_module = 'None' | ||
mod = (f).split('/')[2] | ||
mod_ary.push([mod, version_module]) | ||
width_modules = [width_modules, mod.length].max | ||
width_version = [width_version, version_module.length].max | ||
end | ||
end | ||
|
||
total_width = width_modules + width_version + 7 | ||
|
||
puts '-' * total_width | ||
puts "current version: #{version}" | ||
puts '-' * total_width | ||
puts "| #{'Module'.ljust(width_modules)} | #{'modulesync_config version'.ljust(width_version)} |" | ||
mod_ary.each do |mod, version_module| | ||
puts "| #{mod.ljust(width_modules)} | #{version_module.ljust(width_version)} |" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
skip-changelog: | ||
- head-branch: ['^release-*', 'release'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: "Pull Request Labeler" | ||
|
||
on: | ||
pull_request_target: {} | ||
|
||
jobs: | ||
labeler: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
# Managed by modulesync - DO NOT EDIT | ||
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ | ||
|
||
modulesync_config_version: '9.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.