diff --git a/.github/workflows/smart_proxy_plugin.yml b/.github/workflows/smart_proxy_plugin.yml new file mode 100644 index 0000000..78e1cc3 --- /dev/null +++ b/.github/workflows/smart_proxy_plugin.yml @@ -0,0 +1,48 @@ +--- +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 + plugin_repository: + description: Plugin repository to use + required: false + type: string + plugin_version: + description: Plugin version to use + required: false + type: string + +jobs: + rubies: + name: Verify supported Ruby versions + 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: + 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 }} + 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 diff --git a/.github/workflows/test-gem.yml b/.github/workflows/test-gem.yml index 410afc3..7b69fb4 100644 --- a/.github/workflows/test-gem.yml +++ b/.github/workflows/test-gem.yml @@ -14,6 +14,19 @@ on: default: bundle exec rake spec required: false type: string + environment_variables: + description: arbitrary environment variables from caller + 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: @@ -24,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 }}" @@ -34,7 +50,12 @@ 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 + with: + repository: ${{ inputs.gem_repository }} + ref: ${{ inputs.gem_version }} - name: Setup ruby uses: ruby/setup-ruby@v1 with: