Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 43 additions & 36 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
name: Ruby Build, Lint and Test

on:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize]
push:
branches: [master]
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
build-test-lint:
runs-on: ubuntu-latest

steps:
- name: Checkout xero-ruby repo
uses: actions/checkout@v4
with:
repository: XeroAPI/xero-ruby
path: xero-ruby

- name: Set up Ruby environment
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.0'
bundler-cache: true

- name: Install dependencies
run: bundle install
working-directory: xero-ruby

- name: Compile Build
run: find . -name "*.rb" | xargs -n 1 ruby -c > /dev/null 2>&1 || exit 1
working-directory: xero-ruby

- name: Lint Code
run: bundle exec rubocop
working-directory: xero-ruby

- name: Run Tests
run: bundle exec rake spec
working-directory: xero-ruby
build-test-lint:
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
ruby: "3.2"
- os: ubuntu-latest
ruby: "3.4"
- os: windows-latest
ruby: "3.2"

steps:
- name: Check out event source
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.2.2

- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Compile source
run: bundle exec ruby -e 'Dir["{lib,spec}/**/*.rb"].each { |file| RubyVM::InstructionSequence.compile_file(file) }'

- name: Lint
run: bundle exec rubocop

- name: Test
run: bundle exec rake spec

- name: Build gem
run: bundle exec gem build xero-ruby.gemspec