Flagsets merge to dev #232
Workflow file for this run
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
name: ci | |
on: | |
pull_request: | |
branches: | |
- development | |
- master | |
push: | |
branches: | |
- development | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- '2.5.0' | |
- '3.2.2' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Ruby ${{ matrix.version }} | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.version }} | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: bundle exec rake | |
- name: Fix code coverage paths | |
working-directory: coverage | |
run: | | |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' .resultset.json | |
ruby -rjson -e 'sqube = JSON.load(File.read(".resultset.json"))["RSpec"]["coverage"].transform_values {|lines| lines["lines"]}; total = { "RSpec" => { "coverage" => sqube, "timestamp" => Time.now.to_i }}; puts JSON.dump(total)' > .resultset.sonarqube.json | |
- name: Set VERSION env | |
run: echo "VERSION=$(cat lib/splitclient-rb/version.rb | grep VERSION | awk -F "'" '{print $2}')" >> $GITHUB_ENV | |
- name: SonarQube Scan (Push) | |
if: matrix.version == '3.2.2' && github.event_name == 'push' | |
uses: SonarSource/[email protected] | |
env: | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
projectBaseDir: . | |
args: > | |
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} | |
-Dsonar.projectVersion=${{ env.VERSION }} | |
- name: SonarQube Scan (Pull Request) | |
if: matrix.version == '3.2.2' && github.event_name == 'pull_request' | |
uses: SonarSource/[email protected] | |
env: | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
projectBaseDir: . | |
args: > | |
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} | |
-Dsonar.projectVersion=${{ env.VERSION }} | |
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} | |
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} | |
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} |