From 125a3efad0d97e51e462ff5528f4f5b5b517fefa Mon Sep 17 00:00:00 2001 From: Samir Tapiero Date: Tue, 13 Feb 2024 12:21:24 -0500 Subject: [PATCH] Replace TravisCI to Actions' --- .github/workflows/linter.yml | 25 ++++++++++++++++++++ .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++++++++++ .travis.yml | 28 ----------------------- 3 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..db0211e --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +name: Linter + +on: + pull_request: + branches: ["master", "main"] + + push: + branches: ["master", "main"] + +jobs: + linter: + runs-on: ubuntu-latest + name: linter/ruby + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Run linter + run: bundle exec rake code_analysis diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3f9a8e9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: Test + +on: + pull_request: + branches: ["master", "main"] + + push: + branches: ["master", "main"] + +jobs: + test: + runs-on: ubuntu-latest + container: ${{ matrix.ruby }} + env: + CC_TEST_REPORTER_ID: cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 + strategy: + fail-fast: false + matrix: + include: + - ruby: ruby:2.5 + - ruby: ruby:2.6 + - ruby: ruby:2.7 + - ruby: ruby:3.0 + coverage: true + name: test/ruby ${{ matrix.ruby }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Code Climate test-reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + if: matrix.coverage + - name: Bundle install + run: bundle install -j$(nproc) --retry 3 + - name: Run tests + run: bundle exec rspec + timeout-minutes: 1 + - name: Publish code coverage + run: | + export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" + ./cc-test-reporter after-build -r ${{env.CC_TEST_REPORTER_ID}} + if: matrix.coverage diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 272a430..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: ruby - -rvm: - - 2.5.0 - - 2.6.0 - - ruby-head - -dist: bionic - -jobs: - allow_failures: - - rvm: ruby-head - -env: - global: - - CC_TEST_REPORTER_ID=cb01575b98b3b80848a3bc292ca6145860871470e5d0669453030d36578f9115 - -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - -script: - - bundle exec rake code_analysis - - bundle exec rspec - -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT