-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
90 lines (74 loc) · 2.09 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# frozen_string_literal: true
require 'open-uri'
require 'shellwords'
require 'bundler/audit/task'
require 'rubocop/rake_task'
TERRAFORM_ENVIRONMENTS = %w[
aws
github-org-artichoke
github-org-artichokeruby
github-org-artichoke-ruby
remote-state
].freeze
task default: %i[format lint]
desc 'Lint sources'
task lint: %i[lint:rubocop:autocorrect lint:terraform]
namespace :lint do
RuboCop::RakeTask.new(:rubocop)
desc 'Lint Terraform sources'
task :terraform do
TERRAFORM_ENVIRONMENTS.each do |environment|
sh "terraform -chdir=#{environment} validate"
end
end
end
desc 'Format sources'
task format: %i[format:terraform format:text]
namespace :format do
desc 'Format Terraform sources with terraform fmt'
task :terraform do
sh 'terraform fmt -recursive'
end
desc 'Format text, YAML, and Markdown sources with prettier'
task :text do
sh 'npm run fmt'
end
end
desc 'Format sources'
task fmt: %i[fmt:terraform fmt:text]
namespace :fmt do
desc 'Format Terraform sources with terraform fmt'
task :terraform do
sh 'terraform fmt -recursive'
end
desc 'Format text, YAML, and Markdown sources with prettier'
task :text do
sh 'npm run fmt'
end
end
Bundler::Audit::Task.new
namespace :terraform do
desc 'Lock terraform providers on all plaforms in all environments'
task :'providers:lock' do
TERRAFORM_ENVIRONMENTS.each do |environment|
sh "terraform -chdir=#{environment} providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=linux_amd64"
end
end
end
namespace :release do
link_check_files = FileList.new('**/*.md') do |f|
f.exclude('node_modules/**/*')
f.exclude('**/target/**/*')
f.exclude('**/vendor/**/*')
f.include('*.md')
f.include('**/vendor/*.md')
end
link_check_files.sort.uniq.each do |markdown|
desc 'Check for broken links in markdown files'
task markdown_link_check: markdown do
command = ['npx', 'markdown-link-check', '--config', '.github/markdown-link-check.json', markdown]
sh command.shelljoin
sleep(rand(1..5))
end
end
end