Skip to content
Merged
Show file tree
Hide file tree
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
183 changes: 21 additions & 162 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,167 +1,26 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

name: build
on: pull_request
jobs:
test:
name: Test - Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
ruby:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
exclude:
# Exclude some combinations to reduce CI time if needed
- os: windows-latest
ruby: '3.0'

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ext/parsekit/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install dependencies
run: bundle install

- name: Compile extension
run: bundle exec rake compile

- name: Run tests
run: bundle exec rake spec

- name: Run Rust tests
run: bundle exec rake rust:test
continue-on-error: true # Allow this to fail since we might not have rust tests yet

- name: Upload coverage reports
if: matrix.os == 'ubuntu-latest' && matrix.ruby == '3.2'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy

- name: Check Rust formatting
run: |
cd ext/parsekit
cargo fmt -- --check

- name: Run Clippy
run: |
cd ext/parsekit
cargo clippy -- -D warnings
continue-on-error: true # Allow this to fail initially

- name: Check Ruby syntax
run: |
find lib -name "*.rb" -exec ruby -c {} \;
find spec -name "*.rb" -exec ruby -c {} \;

build:
name: Build gem
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Build gem
run: |
gem build parsekit.gemspec

- name: Upload gem artifact
uses: actions/upload-artifact@v4
with:
name: gem
path: parsekit-*.gem
retention-days: 7
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
tmp
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

security:
name: Security Audit
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Run bundle audit
run: |
gem install bundle-audit
bundle audit check --update
continue-on-error: true

- name: Run cargo audit
run: |
cargo install cargo-audit
cd ext/parsekit
cargo audit
continue-on-error: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler-cache: true

- name: Compile native extension
run: bundle exec rake compile

- name: Run specs
run: |
bundle exec rake spec
159 changes: 0 additions & 159 deletions .github/workflows/release.yml

This file was deleted.

Loading