Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter workflow steps depending on file changes #5721

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
backend:
- '!app/assets/**'
- '!app/views/**'
- '!public/**'
- '!training_content/**'
- '!.github/**'
47 changes: 28 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,45 @@ on: ['push', 'pull_request', 'workflow_dispatch']
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
# checks-out your repository under $GITHUB_WORKSPACE , so that workflow can access it.
- name: checkout
uses: actions/checkout@v2


- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: .github/file-filters.yml
predicate-quantifier: 'every'

- name: install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.9.2.1'

- name: setup Redis
uses: supercharge/[email protected]

# Setting up MariaDB based upon 'config/database.example.yml'
- name: setup MariaDB server
uses: getong/[email protected]
uses: getong/[email protected]
with:
host port: 3306
mariadb version: '10.5'
mysql database: 'dashboard_testing'
host port: 3306
mariadb version: '10.5'
mysql database: 'dashboard_testing'
mysql user: 'wiki'
mysql password: 'wikiedu'
# Starting ruby

# Starting ruby
- name: setup Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true

- name: setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -53,26 +60,27 @@ jobs:
cp config/application.example.yml config/application.yml
cp config/database.example.yml config/database.yml
bin/rails db:migrate RAILS_ENV=test

- name: Cache Webpack cache
id: cache-webpack
uses: actions/cache@v3
with:
path: node_modules/.cache/
key: ${{ runner.os }}-webpack

#Testing the pushed code onwards
- name: JavaScript test suite

- name: JavaScript test suite
run: |
yarn install --immutable
yarn coverage
yarn run test
yarn run test

- name: JavaScript linting
run: yarn lint-non-build

- name: Ruby rspec test suite
if: ${{ steps.filter.outputs.backend == 'true' }}
uses: paambaati/[email protected]
env:
COVERAGE: true
Expand All @@ -81,6 +89,7 @@ jobs:
coverageCommand: bundle exec rspec spec/ --color --profile --format documentation
coverageLocations: |
${{github.workspace}}/public/js_coverage/lcov.info:lcov

- name: Ruby linting
if: ${{ steps.filter.outputs.backend == 'true' }}
run: bundle exec rubocop
Loading