-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Config GH actions * Fix rubocop config * Try to fix simplecov * Try to fix simplecov * Add undercover and rubycritic * Add missing dependency * Update simplecov * Add rspec experiment * Report rspec failures * Install cmake on CircleCI * Install cmake before bundler * Fix rubocop * Remove CC reporter * Update versions * Try another config * Clean up
- Loading branch information
1 parent
3215d97
commit f2d2c91
Showing
14 changed files
with
281 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,10 +33,10 @@ jobs: | |
- run: | ||
name: install dependencies | ||
command: | | ||
sudo apt update | ||
sudo apt install postgresql-client cmake | ||
gem install bundler -v '2.1.4' | ||
bundle install --jobs=4 --retry=3 --path vendor/bundle | ||
sudo apt update | ||
sudo apt install postgresql-client | ||
sudo npm install -g [email protected] | ||
- save_cache: | ||
paths: | ||
|
@@ -51,24 +51,17 @@ jobs: | |
# Database setup | ||
- run: todos/bin/setup | ||
|
||
# Setup coverage report | ||
- run: | ||
name: Setup Code Climate test-reporter | ||
command: | | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
# run tests! | ||
- run: | ||
name: Run tests | ||
command: | | ||
mkdir /tmp/test-results | ||
./cc-test-reporter before-build | ||
bundle exec rspec --format progress \ | ||
--format RspecJunitFormatter \ | ||
--out /tmp/test-results/rspec.xml \ | ||
--format progress | ||
./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $? | ||
# collect reports | ||
# collect reports | ||
- store_test_results: | ||
path: /tmp/test-results | ||
- store_artifacts: | ||
|
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,135 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
name: Run unit tests | ||
env: | ||
POSTGRES_USER: 'postgres' | ||
POSTGRES_HOST: 'localhost' | ||
RAILS_ENV: test | ||
|
||
runs-on: ubuntu-latest | ||
|
||
services: | ||
redis: | ||
image: redis | ||
ports: ['6379:6379'] | ||
options: --entrypoint redis-server | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: 'postgres' | ||
POSTGRES_DB: postgres | ||
POSTGRES_HOST_AUTH_METHOD: 'trust' | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install postgresql-client cmake | ||
sudo npm install -g [email protected] | ||
- name: Database setup | ||
run: | | ||
todos/bin/setup | ||
- run: mkdir tmp/ | ||
|
||
- name: Run rspec | ||
run: bundle exec rspec -f j -o tmp/rspec_results.json | ||
|
||
- name: RSpec Report | ||
uses: SonicGarden/rspec-report-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
json-path: tmp/rspec_results.json | ||
if: always() | ||
|
||
- name: Generate Undercover report | ||
run: | | ||
bundle exec undercover -c origin/master > tmp/undercover.txt || \ | ||
echo "Running undercover and ignoring exit status ..." | ||
bundle exec undercover-checkstyle --compare origin/master > tmp/undercover-checkstyle.xml || \ | ||
echo "Running undercover-checkstyle and ignoring exit status ..." | ||
- name: Archive coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage | ||
path: coverage | ||
retention-days: 10 | ||
|
||
- name: Archive undercover results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: undercover | ||
path: tmp/undercover.txt | ||
retention-days: 10 | ||
|
||
- name: Archive undercover-checkstyle results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: undercover-checkstyle | ||
path: tmp/undercover-checkstyle.xml | ||
retention-days: 10 | ||
|
||
run-linter: | ||
name: Run linter | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
|
||
- name: rubocop | ||
uses: reviewdog/action-rubocop@v2 | ||
with: | ||
rubocop_version: gemfile | ||
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile | ||
github_token: ${{ secrets.github_token }} | ||
|
||
report-diff-coverage: | ||
name: Report diff coverage | ||
needs: test | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: undercover-checkstyle | ||
|
||
- uses: reviewdog/action-setup@v1 | ||
|
||
- name: Comment on PR | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cat undercover-checkstyle.xml | \ | ||
reviewdog -reporter=github-check -name="Diff coverage" -f=checkstyle |
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
Oops, something went wrong.