Skip to content

Commit

Permalink
Bump: Update the CI to make it work on this branch (#25)
Browse files Browse the repository at this point in the history
* Update the CI to make it run on every branch

* Fix version of chromedriver
  • Loading branch information
AyakorK authored Aug 11, 2023
1 parent c42979e commit 7c91423
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 50 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: "[CI] Lint"

on:
push:
branches:
- main
pull_request:
on: [push]

env:
RUBY_VERSION: 3.0.1
CI: "true"
SIMPLECOV: "true"

jobs:
lint-report:
lint:
name: Lint code
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- uses: rokroskar/workflow-run-cleanup-action@v0.3.0
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 1

- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}

- run: npm ci
name: Install JS deps

- run: npm run lint
name: Lint JS files

- run: npm run stylelint
name: Lint SCSS files

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm get cache)-lint"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- name: Install JS dependencies
run: npm ci
- run: bundle exec rubocop -P
name: Lint Ruby files

- run: bundle exec erblint app/**/*.erb
name: Lint ERB files
name: Lint Ruby files
64 changes: 42 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: "[CI] Test"

on:
push:
branches:
- main
pull_request:
name: "[CI] Tests"
on: [push]

env:
RUBY_VERSION: 3.0.1
CI: "true"
CODECOV: "true"
NODE_VERSION: 16.9.1
DECIDIM_MODULE: decidim-extended_socio_demographic_authorization_handler

jobs:
test-report:
main:
name: Tests
runs-on: ubuntu-latest

timeout-minutes: 30
services:
postgres:
image: postgres:11
Expand All @@ -28,25 +27,46 @@ jobs:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost

steps:
- uses: actions/checkout@v2
- uses: rokroskar/workflow-run-cleanup-action@v0.3.0
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 1

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Setup Database
run: bundle exec rake test_app

- name: Run RSpec
run: SIMPLECOV=1 CODECOV=1 bundle exec rspec

- uses: actions/upload-artifact@v2-preview
- uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm get cache)-${{ env.DECIDIM_MODULE }}"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-
- run: bundle exec rake test_app
name: Create test app
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: "114.0.5735.90"
- run: RAILS_ENV=test bundle exec rails assets:precompile
name: Precompile assets
working-directory: ./spec/decidim_dummy_app/
- run: bundle exec rspec
name: RSpec
- uses: codecov/codecov-action@v1
- uses: actions/upload-artifact@v2
if: always()
with:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore

0 comments on commit 7c91423

Please sign in to comment.