-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
91 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,37 @@ on: | |
branches: ['**'] | ||
|
||
jobs: | ||
test: | ||
name: Ruby ${{ matrix.ruby-version }} | ||
|
||
should_run: | ||
name: Run or skip? | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
# All of these options are optional, so you can remove them if you are happy with the defaults | ||
concurrent_skipping: 'never' | ||
skip_after_successful_duplicate: 'true' | ||
paths_ignore: '["**/README.md", "**/docs/**"]' | ||
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | ||
|
||
|
||
ruby_test: | ||
needs: should_run | ||
if: ${{ needs.should_run.outputs.should_skip != 'true' }} | ||
name: Ruby ${{ matrix.ruby-version }} Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- ruby-version: 3.0 | ||
env: | ||
BUNDLE_GEMFILE: .github/ci-gemfiles/ruby-3.0 | ||
BUNDLE_GEMFILE: .github/gemfiles/ruby-3.0 | ||
CODECOV: true | ||
RAKE_MANIFEST: true | ||
CHECK_MANIFEST: true | ||
fail-fast: false | ||
env: ${{ matrix.env }} | ||
|
||
|
@@ -30,18 +50,59 @@ jobs: | |
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
|
||
- name: Run tests | ||
- name: Run Ruby Tests | ||
run: bundle exec rake test | ||
|
||
- name: Run rubocop for github | ||
- name: Run Rubocop | ||
run: bundle exec rubocop --format github | ||
|
||
- name: Codecov | ||
- name: Run Codecov | ||
if: ${{ env.CODECOV == 'true' }} | ||
uses: codecov/[email protected] | ||
with: | ||
fail_ci_if_error: true | ||
|
||
- name: Check whether pagy.manifest is up-to-date in master|dev | ||
if: ${{ env.RAKE_MANIFEST == 'true' && (endsWith(github.ref, '/master') || endsWith(github.ref, '/dev')) }} | ||
- name: Check gem manifest | ||
if: ${{ env.CHECK_MANIFEST == 'true' }} | ||
run: bundle exec rake manifest:check | ||
|
||
|
||
e2e_test: | ||
needs: should_run | ||
if: ${{ needs.should_run.outputs.should_skip != 'true' }} | ||
name: E2E Test | ||
runs-on: ubuntu-latest | ||
env: | ||
# absolute path to run sinatra for cypress in test/e2e working dir | ||
BUNDLE_GEMFILE: /home/runner/work/pagy/pagy/.github/gemfiles/ruby-3.0 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0 | ||
bundler-cache: true | ||
|
||
- name: Cache NPM and Cypress | ||
id: e2e-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/Cypress | ||
node_modules | ||
key: e2e-cache-${{ runner.os }}-${{ hashFiles('test/e2e/ci-cache.lock') }} | ||
|
||
- name: Install Cypress and Test Dependencies | ||
# if: steps.e2e-cache.outputs.cache-hit != 'true' | ||
run: npm i cypress @cypress/snapshot html-validate cypress-html-validate | ||
|
||
- name: Run Cypress Tests | ||
uses: cypress-io/[email protected] | ||
with: | ||
install: false | ||
config: baseUrl=http://0.0.0.0:4567,video=false | ||
start: bundle exec rackup -D -o 0.0.0.0 -p 4567 pagy_app.ru | ||
wait-on: http://0.0.0.0:4567 | ||
working-directory: test/e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cypress:7.3.0 | ||
@cypress/snapshot:2.1.7 | ||
cypress-html-validate:1.5.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# run this in order to ensure the ci cache will get updated with the latest verions | ||
|
||
rm -rf ci-cache.lock | ||
for pkg in cypress @cypress/snapshot cypress-html-validate ; do | ||
echo $pkg:$(npm view $pkg version) >> ci-cache.lock | ||
done |