File: test.sh

package info (click to toggle)
ruby-jekyll-polyglot 1.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,840 kB
  • sloc: xml: 12,011; ruby: 1,740; sh: 32; makefile: 4
file content (33 lines) | stat: -rwxr-xr-x 930 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

# Exit on error
set -e

# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

echo -e "${GREEN}Running RuboCop...${NC}"
bundle exec rubocop

echo -e "${GREEN}Running RSpec tests with coverage...${NC}"
COVERAGE=true bundle exec rspec --format RspecJunitFormatter --out rspec.xml --format json --out rspec.json

# Check if tests passed
if [ $? -eq 0 ]; then
    echo -e "${GREEN}Tests passed!${NC}"
    
    # Upload coverage to Codecov if we're in CI
    if [ "$CI" = "true" ]; then
        echo -e "${GREEN}Uploading coverage to Codecov...${NC}"
        if [ -n "$CODECOV_TOKEN" ]; then
            bash <(curl -s https://codecov.io/bash) -f "coverage/.resultset.json" -t "$CODECOV_TOKEN" -root "$(pwd)"
        else
            bash <(curl -s https://codecov.io/bash) -f "coverage/.resultset.json" -root "$(pwd)"
        fi
    fi
else
    echo -e "${RED}Tests failed!${NC}"
    exit 1
fi