diff --git a/.github/workflows/rack2.yaml b/.github/workflows/rack2.yaml index 58ac10ff..9e4019f2 100644 --- a/.github/workflows/rack2.yaml +++ b/.github/workflows/rack2.yaml @@ -1,21 +1,18 @@ name: Rack_v2 -on: - push: - paths-ignore: - - '**.md' - pull_request: - paths-ignore: - - '**.md' - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] permissions: contents: read # to fetch code (actions/checkout) jobs: + skip_duplicate_runs: + uses: ./.github/workflows/skip_duplicate_workflow_runs.yaml + rack_v2: name: >- Rack_v2: ${{ matrix.os }} ${{ matrix.ruby }} + needs: skip_duplicate_runs env: CI: true TESTOPTS: -v @@ -35,9 +32,11 @@ jobs: steps: - name: repo checkout + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: actions/checkout@v3 - name: load ruby + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} @@ -50,18 +49,23 @@ jobs: # fixes 'has a bug that prevents `required_ruby_version`' - name: update rubygems for Ruby 2.4 - 2.5 - if: contains('2.4 2.5', matrix.ruby) + if: | + contains('2.4 2.5', matrix.ruby) && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') run: gem update --system 3.3.14 --no-document continue-on-error: true timeout-minutes: 5 - name: set WERRORFLAG + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} shell: bash run: echo 'PUMA_MAKE_WARNINGS_INTO_ERRORS=true' >> $GITHUB_ENV - name: compile + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} run: bundle exec rake compile - name: test + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} timeout-minutes: 10 run: bundle exec rake test:all diff --git a/.github/workflows/ragel.yml b/.github/workflows/ragel.yml index 37ce4d84..7712823f 100644 --- a/.github/workflows/ragel.yml +++ b/.github/workflows/ragel.yml @@ -1,23 +1,20 @@ name: ragel -on: - push: - paths: - - 'ext/**' - - '.github/workflows/ragel.yml' - pull_request: - paths: - - 'ext/**' - - '.github/workflows/ragel.yml' - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] permissions: contents: read # to fetch code (actions/checkout) jobs: + skip_duplicate_runs: + uses: ./.github/workflows/skip_duplicate_workflow_runs.yaml + with: + paths: '["ext/**", ".github/workflows/ragel.yml"]' + ragel: name: >- ragel ${{ matrix.os }} ${{ matrix.ruby }} + needs: skip_duplicate_runs env: PUMA_NO_RUBOCOP: true PUMA_TEST_DEBUG: true @@ -37,15 +34,19 @@ jobs: steps: # windows git will convert \n to \r\n - name: git config - if: startsWith(matrix.os, 'windows') + if: | + startsWith(matrix.os, 'windows') && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') run: | git config --global core.autocrlf false git config --global core.eol lf - name: repo checkout + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: actions/checkout@v3 - name: load ruby + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} @@ -55,6 +56,7 @@ jobs: timeout-minutes: 10 - name: check ragel generation + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} shell: pwsh run: | ragel --version diff --git a/.github/workflows/skip_duplicate_workflow_runs.yaml b/.github/workflows/skip_duplicate_workflow_runs.yaml new file mode 100644 index 00000000..41f0d031 --- /dev/null +++ b/.github/workflows/skip_duplicate_workflow_runs.yaml @@ -0,0 +1,32 @@ +name: Skip Duplicate Workflow Runs + +on: + workflow_call: + inputs: + paths: + description: 'A JSON-array with path patterns' + default: '[]' + required: false + type: string + outputs: + should_skip: + description: "The output from the skip_duplicate_runs job" + value: ${{ jobs.skip_duplicate_runs.outputs.should_skip }} + +permissions: + contents: read + +jobs: + skip_duplicate_runs: + name: 'Skip Duplicate Runs' + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5.2.0 + with: + paths_ignore: '["**.md"]' + paths: ${{ inputs.paths }} + concurrent_skipping: 'same_content_newer' # skip newer runs with same content + skip_after_successful_duplicate: 'true' diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b27f7d61..2582ad35 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,20 +1,18 @@ name: Tests -on: - push: - paths-ignore: - - '**.md' - pull_request: - paths-ignore: - - '**.md' - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] permissions: contents: read # to fetch code (actions/checkout) jobs: + skip_duplicate_runs: + uses: ./.github/workflows/skip_duplicate_workflow_runs.yaml + rubocop: name: 'Rubocop linting' + needs: skip_duplicate_runs + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -28,7 +26,7 @@ jobs: test_mri: name: >- MRI: ${{ matrix.os }} ${{ matrix.ruby }}${{ matrix.no-ssl }}${{ matrix.yjit }} - needs: rubocop + needs: [rubocop, skip_duplicate_runs] env: CI: true PUMA_TEST_DEBUG: true @@ -63,9 +61,11 @@ jobs: steps: - name: repo checkout + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: actions/checkout@v3 - name: load ruby + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} @@ -78,35 +78,45 @@ jobs: # fixes 'has a bug that prevents `required_ruby_version`' - name: update rubygems for Ruby 2.4 - 2.5 - if: contains('2.4 2.5', matrix.ruby) + if: | + contains('2.4 2.5', matrix.ruby) && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') run: gem update --system 3.3.14 --no-document continue-on-error: true timeout-minutes: 5 - name: Compile Puma without SSL support - if: matrix.no-ssl == ' no SSL' + if: | + (matrix.no-ssl == ' no SSL') && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') shell: bash run: echo 'PUMA_DISABLE_SSL=true' >> $GITHUB_ENV - name: set WERRORFLAG + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} shell: bash run: echo 'PUMA_MAKE_WARNINGS_INTO_ERRORS=true' >> $GITHUB_ENV - name: compile + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} run: bundle exec rake compile - name: Use yjit - if: matrix.yjit == ' yjit' + if: | + (matrix.yjit == ' yjit') && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') shell: bash run: echo 'RUBYOPT=--yjit' >> $GITHUB_ENV - name: test + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} timeout-minutes: 10 run: bundle exec rake test:all + test_non_mri: name: >- NON-MRI: ${{ matrix.os }} ${{ matrix.ruby }}${{ matrix.no-ssl }} - needs: rubocop + needs: [rubocop, skip_duplicate_runs] env: CI: true TESTOPTS: -v @@ -133,15 +143,19 @@ jobs: steps: - name: repo checkout + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: actions/checkout@v3 - name: set JAVA_HOME - if: startsWith(matrix.os, 'macos') + if: | + startsWith(matrix.os, 'macos') && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') shell: bash run: | echo JAVA_HOME=$JAVA_HOME_11_X64 >> $GITHUB_ENV - name: load ruby, ragel + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} @@ -152,22 +166,28 @@ jobs: timeout-minutes: 10 - name: Compile Puma without SSL support - if: matrix.no-ssl == ' no SSL' + if: | + (matrix.no-ssl == ' no SSL') && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') shell: bash run: echo 'PUMA_DISABLE_SSL=true' >> $GITHUB_ENV - name: set WERRORFLAG + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} shell: bash run: echo 'PUMA_MAKE_WARNINGS_INTO_ERRORS=true' >> $GITHUB_ENV - name: compile + if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }} run: bundle exec rake compile - name: test id: test timeout-minutes: 12 continue-on-error: ${{ matrix.allow-failure || false }} - if: success() # only run if previous steps have succeeded + if: | # only run if previous steps have succeeded + success() && + (needs.skip_duplicate_runs.outputs.should_skip != 'true') run: bundle exec rake test:all - name: >-