From f1329d24fbc66951cb4f789c0da3f84c8444905f Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 09:36:11 +0200 Subject: [PATCH 01/11] Remove Dockerfile --- Dockerfile | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d34c98d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ruby:2.7.2-slim-buster AS base - -RUN apt-get update -yqq && apt-get -yqq --no-install-recommends install build-essential - -COPY Gemfile Gemfile -COPY Gemfile.lock Gemfile.lock -RUN gem install bundler -RUN bundle config set with 'development test' -RUN bundle install --jobs 20 --retry 5 -COPY app /app - -COPY entrypoint.rb /entrypoint.rb -FROM base AS test -CMD cd app && bundle exec rspec - -FROM base AS release -ENTRYPOINT ["/entrypoint.rb"] From 99e53734bd290f1a04746877540310f3c78df0c9 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 09:36:30 +0200 Subject: [PATCH 02/11] Use composite instead of docker for running action --- action.yml | 29 ++++++++++++++++++----------- entrypoint.rb | 9 ++++++++- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/action.yml b/action.yml index 28c592a..37fcddd 100644 --- a/action.yml +++ b/action.yml @@ -36,17 +36,24 @@ inputs: default: true runs: - using: "docker" - image: "Dockerfile" - args: - - ${{ inputs.allowed-conclusions }} - - ${{ inputs.check-name }} - - ${{ inputs.check-regexp }} - - ${{ inputs.ref }} - - ${{ inputs.repo-token }} - - ${{ inputs.verbose }} - - ${{ inputs.wait-interval }} - - ${{ inputs.running-workflow-name }} + using: "composite" + steps: + - uses: actions/setup-ruby@v1 + with: + ruby-version: '2.7' + - run: bundle install + shell: bash + - run: ruby ${{ github.action_path }}/entrypoint.rb + shell: bash + env: + ALLOWED_CONCLUSIONS: ${{ inputs.allowed-conclusions }} + CHECK_NAME: ${{ inputs.check-name }} + CHECK_REGEXP: ${{ inputs.check-regexp }} + REF: ${{ inputs.ref }} + REPO_TOKEN: ${{ inputs.repo-token }} + VERBOSE: ${{ inputs.verbose }} + WAIT_INTERVAL: ${{ inputs.wait-interval }} + RUNNING_WORKFLOW_NAME: ${{ inputs.running-workflow-name }} branding: icon: "check-circle" color: "green" diff --git a/entrypoint.rb b/entrypoint.rb index 080a5e8..fc1ab14 100755 --- a/entrypoint.rb +++ b/entrypoint.rb @@ -2,7 +2,14 @@ require_relative "./app/services/github_checks_verifier" require "octokit" -allowed_conclusions, check_name, check_regexp, ref, token, verbose, wait, workflow_name = ARGV +allowed_conclusions = ENV["ALLOWED_CONCLUSIONS"] +check_name = ENV["CHECK_NAME"] +check_regexp = ENV["CHECK_REGEXP"] +ref = ENV["REF"] +token = ENV["REPO_TOKEN"] +verbose = ENV["VERBOSE"] +wait = ENV["WAIT_INTERVAL"] +workflow_name = ENV["RUNNING_WORKFLOW_NAME"] GithubChecksVerifier.configure do |config| config.allowed_conclusions = allowed_conclusions.split(",").map(&:strip) From 1f5b00066be6bd04bbf2555c3386469c8dd3edc0 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 09:38:55 +0200 Subject: [PATCH 03/11] Fix Rubocop error --- entrypoint.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/entrypoint.rb b/entrypoint.rb index fc1ab14..f46855f 100755 --- a/entrypoint.rb +++ b/entrypoint.rb @@ -3,13 +3,13 @@ require "octokit" allowed_conclusions = ENV["ALLOWED_CONCLUSIONS"] -check_name = ENV["CHECK_NAME"] -check_regexp = ENV["CHECK_REGEXP"] -ref = ENV["REF"] -token = ENV["REPO_TOKEN"] -verbose = ENV["VERBOSE"] -wait = ENV["WAIT_INTERVAL"] -workflow_name = ENV["RUNNING_WORKFLOW_NAME"] +check_name = ENV["CHECK_NAME"] +check_regexp = ENV["CHECK_REGEXP"] +ref = ENV["REF"] +token = ENV["REPO_TOKEN"] +verbose = ENV["VERBOSE"] +wait = ENV["WAIT_INTERVAL"] +workflow_name = ENV["RUNNING_WORKFLOW_NAME"] GithubChecksVerifier.configure do |config| config.allowed_conclusions = allowed_conclusions.split(",").map(&:strip) From 414cc3080e3b9febae615dd537ac6d509972b50c Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 21:24:53 +0200 Subject: [PATCH 04/11] Add workflows running on Windows and Mac --- .../wait-using-mac-hosted-runner.yml | 21 +++++++++++++++++++ .../wait-using-windows-hosted-runner.yml | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/wait-using-mac-hosted-runner.yml create mode 100644 .github/workflows/wait-using-windows-hosted-runner.yml diff --git a/.github/workflows/wait-using-mac-hosted-runner.yml b/.github/workflows/wait-using-mac-hosted-runner.yml new file mode 100644 index 0000000..eb12b13 --- /dev/null +++ b/.github/workflows/wait-using-mac-hosted-runner.yml @@ -0,0 +1,21 @@ +name: Wait using Mac +on: + push: + workflow_dispatch: + +jobs: + wait-on-mac: + runs-on: mac-latest + steps: + - uses: actions/checkout@v2 + - name: Wait on tests + uses: ./ + with: + ref: ${{ github.sha }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 # seconds + running-workflow-name: wait-on-mac + check-name: wait-on-me + + - name: Success + run: echo 'Success!' diff --git a/.github/workflows/wait-using-windows-hosted-runner.yml b/.github/workflows/wait-using-windows-hosted-runner.yml new file mode 100644 index 0000000..8995c2a --- /dev/null +++ b/.github/workflows/wait-using-windows-hosted-runner.yml @@ -0,0 +1,21 @@ +name: Wait using Windows +on: + push: + workflow_dispatch: + +jobs: + wait-on-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Wait on tests + uses: ./ + with: + ref: ${{ github.sha }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 # seconds + running-workflow-name: wait-on-windows + check-name: wait-on-me + + - name: Success + run: echo 'Success!' From 5dcd8cea1e882536e0aea895786c7e37a341d5b3 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 21:28:15 +0200 Subject: [PATCH 05/11] Fix typo --- .github/workflows/wait-using-mac-hosted-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wait-using-mac-hosted-runner.yml b/.github/workflows/wait-using-mac-hosted-runner.yml index eb12b13..cac126d 100644 --- a/.github/workflows/wait-using-mac-hosted-runner.yml +++ b/.github/workflows/wait-using-mac-hosted-runner.yml @@ -5,7 +5,7 @@ on: jobs: wait-on-mac: - runs-on: mac-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Wait on tests From 09789c8b62eac7be002c7c244e7627b34cf82011 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 21:31:30 +0200 Subject: [PATCH 06/11] Replace actions/setup-ruby with ruby/setup-ruby --- .github/workflows/run-tests.yml | 6 +++--- action.yml | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8340405..bae8037 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 - - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: 2.7 + bundler-cache: true - name: Install dependencies run: bundle install diff --git a/action.yml b/action.yml index 37fcddd..94ba5ca 100644 --- a/action.yml +++ b/action.yml @@ -38,11 +38,10 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-ruby@v1 + - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' - - run: bundle install - shell: bash + ruby-version: 2.7 # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - run: ruby ${{ github.action_path }}/entrypoint.rb shell: bash env: From 3af5c91cb968cdec1c38818ddd691125818ba0c0 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 21:39:14 +0200 Subject: [PATCH 07/11] Add supported platform to Gemfile.lock --- Gemfile.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile.lock b/Gemfile.lock index 9a717a2..1c3bc9f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,6 +73,7 @@ GEM zeitwerk (2.4.2) PLATFORMS + x64-mingw32 x86_64-darwin-19 x86_64-linux From bad4e39645c65946e65e9d2504b4ea03c64232a9 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 21:48:15 +0200 Subject: [PATCH 08/11] Fix typo and try running entrypoint --- .github/workflows/run-tests.yml | 6 +++--- action.yml | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index bae8037..0e9d4dd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,9 +17,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - bundler-cache: true + with: + ruby-version: 2.7 + bundler-cache: true - name: Install dependencies run: bundle install diff --git a/action.yml b/action.yml index 94ba5ca..d2d9d32 100644 --- a/action.yml +++ b/action.yml @@ -42,7 +42,9 @@ runs: with: ruby-version: 2.7 # Not needed with a .ruby-version file bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: ruby ${{ github.action_path }}/entrypoint.rb + - run: | + cd ${{ github.action_path }} + ruby ./entrypoint.rb shell: bash env: ALLOWED_CONCLUSIONS: ${{ inputs.allowed-conclusions }} From c23054c135c5171a9ac78371d49fad3227270136 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 22:08:39 +0200 Subject: [PATCH 09/11] Update action.yml --- action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d2d9d32..6d3c102 100644 --- a/action.yml +++ b/action.yml @@ -42,9 +42,7 @@ runs: with: ruby-version: 2.7 # Not needed with a .ruby-version file bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: | - cd ${{ github.action_path }} - ruby ./entrypoint.rb + - run: ruby entrypoint.rb shell: bash env: ALLOWED_CONCLUSIONS: ${{ inputs.allowed-conclusions }} From cb8c0658f303ab064a58cfbe331d3a93bd569149 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 22:10:08 +0200 Subject: [PATCH 10/11] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 6d3c102..06a1d44 100644 --- a/action.yml +++ b/action.yml @@ -41,7 +41,7 @@ runs: - uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 # Not needed with a .ruby-version file - bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - run: bundle install - run: ruby entrypoint.rb shell: bash env: From 62e8671d65c738c079fba4ceaab6a73965174180 Mon Sep 17 00:00:00 2001 From: Matias Albarello Date: Sat, 11 Sep 2021 22:10:58 +0200 Subject: [PATCH 11/11] Update action.yml --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 06a1d44..01d11b0 100644 --- a/action.yml +++ b/action.yml @@ -42,6 +42,7 @@ runs: with: ruby-version: 2.7 # Not needed with a .ruby-version file - run: bundle install + shell: bash - run: ruby entrypoint.rb shell: bash env: