sinatra/.github/workflows/test.yml

95 lines
2.9 KiB
YAML
Raw Normal View History

2021-04-17 17:03:20 +00:00
name: Testing
on:
push:
branches:
- '**'
2021-04-17 17:03:20 +00:00
pull_request:
permissions:
contents: read # to fetch code (actions/checkout)
2021-04-17 17:03:20 +00:00
jobs:
test:
permissions:
contents: read # to fetch code (actions/checkout)
actions: read # to list jobs for workflow run (8398a7/action-slack)
2022-11-08 18:49:42 +00:00
name: ${{ matrix.ruby }} (Rack ${{ matrix.rack }}, Puma ${{ matrix.puma }})
2021-04-17 17:03:20 +00:00
runs-on: ubuntu-latest
timeout-minutes: 15
2021-04-17 17:03:20 +00:00
strategy:
fail-fast: false
2021-04-17 17:03:20 +00:00
matrix:
puma:
- '~> 5' # Due to https://github.com/puma/puma/issues/3000
2022-07-19 21:57:41 +00:00
rack:
- stable
2021-04-17 17:03:20 +00:00
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [2.6, 2.7, '3.0', 3.1, 'jruby-9.3', truffleruby, truffleruby-head]
2022-07-19 21:57:41 +00:00
include:
- { ruby: 3.1, rack: stable, puma: latest, allow-failure: true }
- { ruby: 3.1, rack: latest, allow-failure: true }
2022-07-19 22:34:28 +00:00
- { ruby: jruby-head, rack: stable, allow-failure: true }
2022-07-19 21:57:41 +00:00
env:
rack: ${{ matrix.rack }}
puma: ${{ matrix.puma }}
2021-04-17 17:03:20 +00:00
steps:
- name: Install dependencies
run: |
sudo apt-get install --yes \
pandoc \
nodejs \
pkg-config \
libxml2-dev \
libxslt-dev \
libyaml-dev
- uses: actions/checkout@v3
2021-04-17 17:03:20 +00:00
- uses: ruby/setup-ruby@v1
continue-on-error: ${{ matrix.allow-failure || false }}
id: setup-ruby
2021-04-17 17:03:20 +00:00
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
2022-02-05 11:30:48 +00:00
- name: Run sinatra tests
2022-07-19 21:57:41 +00:00
continue-on-error: ${{ matrix.allow-failure || false }}
id: tests
2022-02-05 11:30:48 +00:00
run: bundle exec rake
2022-02-05 11:30:48 +00:00
- name: Run sinatra-contrib tests
2022-07-19 21:57:41 +00:00
continue-on-error: ${{ matrix.allow-failure || false }}
id: contrib-tests
2022-02-18 06:46:58 +00:00
working-directory: sinatra-contrib
2022-02-05 11:30:48 +00:00
run: |
bundle install --jobs=3 --retry=3
bundle exec rake
2022-02-05 11:30:48 +00:00
- name: Run rack-protection tests
2022-07-19 21:57:41 +00:00
continue-on-error: ${{ matrix.allow-failure || false }}
id: protection-tests
2022-02-18 06:46:58 +00:00
working-directory: rack-protection
2022-02-05 11:30:48 +00:00
run: |
bundle install --jobs=3 --retry=3
bundle exec rake
2021-05-07 22:00:46 +00:00
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
2021-05-07 22:20:24 +00:00
fields: repo,message,commit,author,ref,job,took # selectable (default: repo,message)
2021-05-07 22:00:46 +00:00
env:
2021-05-07 22:20:24 +00:00
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required
if: failure() && env.SLACK_WEBHOOK_URL
2022-07-19 21:57:41 +00:00
# because continue-on-error marks the steps as pass even if they fail
- name: "setup-ruby (bundle install) outcome: ${{ steps.setup-ruby.outcome }}"
run: ""
2022-07-19 21:57:41 +00:00
- name: "sinatra tests outcome: ${{ steps.tests.outcome }}"
run: ""
- name: "sinatra-contrib tests outcome: ${{ steps.contrib-tests.outcome }}"
run: ""
- name: "rack-protection tests outcome: ${{ steps.protection-tests.outcome }}"
run: ""