You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.3 KiB
Plaintext

# .semaphore/semaphore.yml
version: v1.0
name: Rails project
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
blocks:
- name: Setup
dependencies: []
task:
jobs:
- name: bundle
commands:
- sem-version ruby <%= RUBY_VERSION[/\d+\.\d+/] %>
- sem-version node 16.15.0
- checkout
- cache restore
- bundle install
- cache store
- name: Code scanning
dependencies:
- Setup
task:
jobs:
- name: check style + security
commands:
- sem-version ruby 2.7.5
- sem-version node 16.15.0
- checkout
- cache restore
- bundle install
- cache store
- bundle exec rubocop
- bundle exec brakeman
- bundle exec flay
- name: Unit tests
dependencies:
- Code scanning
task:
prologue:
commands:
- sem-version ruby 2.7.5
- sem-version node 16.15.0
- checkout
- cache restore
- bundle install
- cache store
- sem-service start postgres
- 'bundle exec rake db:setup'
jobs:
- name: RSpec - model tests
commands:
- bundle exec rspec spec/models
- name: RSpec - controller tests
commands:
- bundle exec rspec spec/controllers
epilogue:
always:
commands:
- "[[ -f junit.xml ]] && test-results publish --name \"🧪 Unit tests\" junit.xml"
- name: Integration tests
dependencies:
- Unit tests
task:
prologue:
commands:
- sem-version ruby 2.7.5
- sem-version node 16.15.0
- checkout
- cache restore
- bundle install
- cache store
jobs:
- name: RSpec - feature specs
commands:
- sem-service start postgres
- 'bundle exec rake db:setup'
- bundle exec rspec spec/features
epilogue:
always:
commands:
- "[[ -f junit.xml ]] && test-results publish --name \"🏗️ Integration tests\" junit.xml"
after_pipeline:
task:
jobs:
- name: Publish Results
commands:
- test-results gen-pipeline-report