Is there a way to run gherkin lint for committed files? - bdd

I'm using gherkin-lint for my wdio/cucumber-framework and I would like to run the gherkin lint for the committed files only.
I have tried using the lint command and it does for all the files, not only the committed files ?

If you're not averse to using another gherkin linter, try reformat-gherkin together with pre-commit. Their repo has instructions: https://github.com/ducminh-phan/reformat-gherkin
If this is too much of a change for your workflow, here's a guide to using gherkin-lint using a git hook, although it's many more steps and won't be reproduced for your collaborators: https://qaankush.medium.com/governance-of-cucumber-projects-using-git-hooks-and-gherkin-lint-69e199045695

Related

How to get files produced during a Travis-CI build?

I am using Travis-CI to test code in a repository. There are quite some files after the testing and I would like to have them at a persistent place. How can I do that under the context of Travis-CI?
As an artificial example, suppose my Travis-CI server runs a C program that stores a large number of integers in a specific file. The file can be found at the Travis-CI server after the build. But how can I get that file? In my use case, this file is large and it would not make sense to read it from the console of Travis-CI; in other words, I would not consider using "cat ..." in .travis.yml.
After some search, here is what I got:
The most convenient way seems to deploy the generated files to GitHub pages. The process is explained here: https://docs.travis-ci.com/user/deployment/pages/. In short:
first, create a GitHub page from the repository under test. This can be done through the Github web of the repository. The outcome includes an additional remote branch called gh-=pages generated.
then, in .travis.yml, use the deploy section to specify the condition to do the deployment.

Setting up your module with Travis CI

Anyone got a boilerplate the world can use for Travis CI build testing for modules?
I havn't used Travis CI before but I got it hooked up however all my builds are failing, and the logs just say phpunit exited with code 1. I assume I'm definitely missing something and I have a feeling I need to download all silverstripe composer dependecies but have no idea where to start
I'm wanting it to run tests against (mymodule)/tests folder and hoping it's possible
The section on "Connecting to CI" isn't very helpful!
To set up with travis you'll need to use the travis-support module.
It's quite straightforward to do with a boilerplate .travis.yml which you can see on pretty much any SilverStripe module that's using travis. Here's a pretty standard one.
That file will test against PHP 5.3-5.6 as well as against SilverStripe versions 3.1.x-dev (latest 3.1 development version) all the way to 3.x-dev (3.5 development version).
You'll also need to customise the final line to run the correct test suite.

Multiple Environments in Travis CI

Travis has an easy way to test a project against different PHP versions.
Now I want to run tests for plugins. For that I wrote a script that is called in the install phase of .travis.yml which checks out the main project and moves my plugin source into the correct directory. Then the tests are run. So far so good.
Now I would like to provide two of these scripts. One that checks out the main project's current master branch and one that checks out the latest stable version. The plugin should be tested against both checkouts in completely separate test runs just like it is ran against different PHP versions.
Is there a simple way to configure this in .travis.yml?
You need to use env option:
env:
- TEST_NAME=my_test_1
- TEST_NAME=my_test_2
- TEST_NAME=my_test_3
script:
- ./test-run.sh --test-name=${TEST_NAME}
documentation (Set environment variables section)
example

how do you integrate jenkins with a rails project correctly?

I understand that there are other posts in regards to this but there are two issues with my setup:
When the jasmine-ci throws an exception my build is still passing instead of failing.
Is this the most eloquent way of doing this (ssh lines + rake tasks)? I feel like there should be a prettier/nicer way of integrating ruby+jenkins?
What you need is ci_reporter gem.
http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/
This gem wrap spec rake task and makes xml output which could be understand by Jenkins and report failure if tests don't pass.
I think Jenkins doesn't know much about Ruby and RVM and your project environment. This is why you need to write custom shell task, specifying version of Ruby, database.yml config and so on.
Good luck with Jenkins, but I can't wait for private Travis CI release)

Excluding files from being deployed with Capistrano while still under version control with Git

I want to start testing the JavaScript in my Rails apps with qUnit and I'm wondering how to keep the test JavaScript and test runner HTML page under version control (I'm using Git, of course) but keep them off the production server when I deploy the app with Capistrano. My first thought is to let Capistrano send all the code over as usual including the test files, and write a task to delete them at the end of the deployment process. This seems like sort of a hack, though. Is there a cleaner way to tell Capistrano to ignore certain parts of the repository when deploying?
There are many ways to accomplish this, you can keep your tests in a test branch of the app like VonC suggested, but that would mean that you would make all your changes in your main branch and then sync it to your test branch. (Not without its merits, but sometimes a pain)
You can use the .gitignore file to your directory.
Any file that you add to this will not be added to your repository. Since capistrano just pulls and posts from your repository, not having the files included will keep them off your production server.
Last but not least, if you want the test files in your main repository for version control, you can add a recipe to your config/deploy.rb file.. something like:
desc "Remove Test Files"
task :remove_test_files , :roles => :web do
sudo %{rm -f #{current_path}/public/javascripts/testfile.js}
sudo %{rm -f #{current_path}/public/javascripts/anothertestfile.js}
end
after 'deploy:remove_test_files'
And specify the files you want to remove, this will remove any files you want when you deploy. :)
Any of the above will work. Pick the method that works for you.
As of August 30th, 2013, you can simply create a .gitattributes file and export-ignore the files/folders of your choice.
features/ export-ignore
spec/ export-ignore
Reference: https://github.com/capistrano/capistrano/pull/626
You could have those tests in a test branch (on which you merge your main branch before any test)
That way, when you ask Capistrano to deploy what is on your main branch, no test of any sort is ever included.

Resources