From 0aeb076e097308ad9496749fc93ffee661b14a15 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 5 Jan 2024 14:26:38 +0100 Subject: [PATCH 1/4] add proxy plugin workflow --- .github/workflows/smart_proxy_plugin.yml | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/smart_proxy_plugin.yml diff --git a/.github/workflows/smart_proxy_plugin.yml b/.github/workflows/smart_proxy_plugin.yml new file mode 100644 index 0000000..e088a0d --- /dev/null +++ b/.github/workflows/smart_proxy_plugin.yml @@ -0,0 +1,35 @@ +--- +name: Foreman Proxy Plugin + +on: + workflow_call: + inputs: + foreman_proxy_version: + description: Foraman Proxy version to use + default: 'develop' + required: false + type: string + foreman_proxy_repository: + description: Foreman Proxy repository to use + default: 'theforeman/smart-proxy' + required: false + type: string + +jobs: + rubies: + name: Verify supported Ruby versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Verify supported Ruby versions + uses: theforeman/gha-matrix-ruby-verifier@v0 + with: + repository: ${{ inputs.foreman_proxy_repository }} + ref: ${{ inputs.foreman_proxy_version }} + test: + name: Tests + uses: theforeman/actions/.github/workflows/test-gem.yml@v0 + with: + command: bundle exec rake test + environment_variables: | + SMART_PROXY_BRANCH=${{ inputs.foreman_proxy_version }} From f44570f6f7c79be9c292ba76541d5645e5ea27d6 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 14 Oct 2024 08:51:42 +0200 Subject: [PATCH 2/4] accept env vars when running test-gem --- .github/workflows/test-gem.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-gem.yml b/.github/workflows/test-gem.yml index 410afc3..88a7299 100644 --- a/.github/workflows/test-gem.yml +++ b/.github/workflows/test-gem.yml @@ -14,6 +14,11 @@ on: default: bundle exec rake spec required: false type: string + environment_variables: + description: arbitrary environment variables from caller + required: false + default: '' + type: string jobs: setup_matrix: @@ -34,6 +39,8 @@ jobs: matrix: ruby: ${{ fromJSON(needs.setup_matrix.outputs.ruby) }} steps: + - name: Load environment variables from caller + run: echo "${{ inputs.environment_variables }}" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Setup ruby uses: ruby/setup-ruby@v1 From 0550c086b6da31345a6f366835703147f9472238 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 14 Oct 2024 09:49:40 +0200 Subject: [PATCH 3/4] support checking out any repo for test-gem --- .github/workflows/test-gem.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test-gem.yml b/.github/workflows/test-gem.yml index 88a7299..7b69fb4 100644 --- a/.github/workflows/test-gem.yml +++ b/.github/workflows/test-gem.yml @@ -19,6 +19,14 @@ on: required: false default: '' type: string + gem_repository: + description: Gem repository to use + required: false + type: string + gem_version: + description: Gem version to use + required: false + type: string jobs: setup_matrix: @@ -29,6 +37,9 @@ jobs: steps: - id: ruby uses: ekohl/ruby-version@v0 + with: + repository: ${{ inputs.gem_repository }} + ref: ${{ inputs.gem_version }} test: name: "Ruby ${{ matrix.ruby }}" @@ -42,6 +53,9 @@ jobs: - name: Load environment variables from caller run: echo "${{ inputs.environment_variables }}" >> $GITHUB_ENV - uses: actions/checkout@v4 + with: + repository: ${{ inputs.gem_repository }} + ref: ${{ inputs.gem_version }} - name: Setup ruby uses: ruby/setup-ruby@v1 with: From f54d5e1b56817774c69612216eedd7475aed8e06 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 14 Oct 2024 09:49:13 +0200 Subject: [PATCH 4/4] add test for smart_proxy_plugin --- .github/workflows/smart_proxy_plugin.yml | 13 +++++++++++++ .../smart_proxy_plugin_workflow_test.yml | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/smart_proxy_plugin_workflow_test.yml diff --git a/.github/workflows/smart_proxy_plugin.yml b/.github/workflows/smart_proxy_plugin.yml index e088a0d..78e1cc3 100644 --- a/.github/workflows/smart_proxy_plugin.yml +++ b/.github/workflows/smart_proxy_plugin.yml @@ -14,6 +14,14 @@ on: default: 'theforeman/smart-proxy' required: false type: string + plugin_repository: + description: Plugin repository to use + required: false + type: string + plugin_version: + description: Plugin version to use + required: false + type: string jobs: rubies: @@ -21,6 +29,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + repository: ${{ inputs.plugin_repository }} + ref: ${{ inputs.plugin_version }} - name: Verify supported Ruby versions uses: theforeman/gha-matrix-ruby-verifier@v0 with: @@ -33,3 +44,5 @@ jobs: command: bundle exec rake test environment_variables: | SMART_PROXY_BRANCH=${{ inputs.foreman_proxy_version }} + gem_repository: ${{ inputs.plugin_repository }} + gem_version: ${{ inputs.plugin_version }} diff --git a/.github/workflows/smart_proxy_plugin_workflow_test.yml b/.github/workflows/smart_proxy_plugin_workflow_test.yml new file mode 100644 index 0000000..91afbed --- /dev/null +++ b/.github/workflows/smart_proxy_plugin_workflow_test.yml @@ -0,0 +1,19 @@ +--- +name: Test smart_proxy_plugin.yml + +on: + pull_request: + paths: + - '.github/workflows/smart_proxy_plugin.yml' + - '.github/workflows/smart_proxy_plugin_workflow_test.yml' + +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + test: + name: Ruby + uses: ./.github/workflows/smart_proxy_plugin.yml + with: + plugin_repository: theforeman/smart_proxy_pulp