From 9cd6651ff1ccf09361a46b60def07efd41373389 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 4 Sep 2023 08:16:02 +1200 Subject: [PATCH 1/4] ci: use junit annotation action --- .github/workflows/checks.yml | 7 ++++++- Gemfile | 1 + Gemfile.lock | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 07b8af3..962691f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -32,7 +32,12 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - run: bundle exec rspec + - run: bundle exec rspec --format RspecJunitFormatter --out junit.xml --format progress + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: success() || failure() + with: + report_paths: 'junit.xml' lint: runs-on: ubuntu-latest steps: diff --git a/Gemfile b/Gemfile index f174c3f..d820f87 100644 --- a/Gemfile +++ b/Gemfile @@ -13,3 +13,4 @@ gem "rubocop", "~> 1.21" gem "rubocop-performance" gem "rubocop-rspec" gem "simplecov", require: false +gem "rspec_junit_formatter", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6880e17..0783c7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,6 +52,8 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-support (3.11.0) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) rubocop (1.56.0) base64 (~> 0.1.1) json (~> 2.3) @@ -96,6 +98,7 @@ DEPENDENCIES aws_ec2_environment! rake (~> 13.0) rspec (~> 3.0) + rspec_junit_formatter rubocop (~> 1.21) rubocop-performance rubocop-rspec From 1c0a6e60f48884c53cf6cba6690438581f4994d8 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 4 Sep 2023 08:17:10 +1200 Subject: [PATCH 2/4] test: cause a failure --- lib/aws_ec2_environment.rb | 1 + lib/aws_ec2_environment/ssm_port_forwarding_session.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/aws_ec2_environment.rb b/lib/aws_ec2_environment.rb index 798f606..9dc8c5a 100644 --- a/lib/aws_ec2_environment.rb +++ b/lib/aws_ec2_environment.rb @@ -97,6 +97,7 @@ def bastion_public_ip log "using bastion with ip #{ip_address}" ip_address + [] end # Builds a +ProxyCommand+ that can be used with +ssh+ to connect through the bastion instance, diff --git a/lib/aws_ec2_environment/ssm_port_forwarding_session.rb b/lib/aws_ec2_environment/ssm_port_forwarding_session.rb index 65cb1ab..c564cec 100644 --- a/lib/aws_ec2_environment/ssm_port_forwarding_session.rb +++ b/lib/aws_ec2_environment/ssm_port_forwarding_session.rb @@ -115,7 +115,7 @@ def update_cmd_output # do nothing as we don't want to block rescue Errno::EIO output = @cmd_output.strip - output = "" if output.empty? + # output = "" if output.empty? raise SessionProcessError, output end From 24aeef04df5deddbb4fa02613ec2eea0284eb527 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 4 Sep 2023 09:09:38 +1200 Subject: [PATCH 3/4] test: try failing for just a specific ruby version --- lib/aws_ec2_environment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aws_ec2_environment.rb b/lib/aws_ec2_environment.rb index 9dc8c5a..237cb02 100644 --- a/lib/aws_ec2_environment.rb +++ b/lib/aws_ec2_environment.rb @@ -96,7 +96,7 @@ def bastion_public_ip log "using bastion with ip #{ip_address}" - ip_address + return ip_address unless RUBY_VERSION.start_with?("3.0") [] end From 15527cbbf0ce13d6d41174750ab3f402228c9463 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 4 Sep 2023 09:16:25 +1200 Subject: [PATCH 4/4] ci: include matrix info in report name --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 962691f..8ecf7cc 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -32,12 +32,12 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - run: bundle exec rspec --format RspecJunitFormatter --out junit.xml --format progress + - run: bundle exec rspec --format RspecJunitFormatter --out junit-${{ matrix.ruby }}.xml --format progress - name: Publish Test Report uses: mikepenz/action-junit-report@v3 if: success() || failure() with: - report_paths: 'junit.xml' + report_paths: 'junit-${{ matrix.ruby }}.xml' lint: runs-on: ubuntu-latest steps: