Skip to content

Commit

Permalink
Merge pull request #17 from genya0407/feature/faster-ci
Browse files Browse the repository at this point in the history
Faster CI
  • Loading branch information
genya0407 authored Dec 31, 2023
2 parents c2d4334 + 10f9dbc commit 70a7c23
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Lint

on: [push, pull_request]
on: pull_request
jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -10,5 +10,5 @@ jobs:
- name: Lint README.md
uses: avto-dev/markdown-lint@v1
with:
args: 'README.md'
config: '.markdownlint.config.json'
args: "README.md"
config: ".markdownlint.config.json"
66 changes: 61 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Test

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on: pull_request
jobs:
cargo_test:
Expand All @@ -10,16 +14,68 @@ jobs:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
ruby-version: "3.1"
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace

integration_test:
name: run all integration tests
generate-example-matrix:
runs-on: ubuntu-latest
outputs:
examples: ${{ steps.set-matrix.outputs.examples }}
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: make values
id: set-matrix
run: |
cat <<CODE | ruby >> $GITHUB_OUTPUT
require 'json'
puts "examples=#{JSON.generate(Dir.glob('examples/*'))}"
CODE
examples:
name: run specs on examples
runs-on: ubuntu-latest
needs: generate-example-matrix
strategy:
fail-fast: false
matrix:
example: ${{ fromJson(needs.generate-example-matrix.outputs.examples) }}
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
- run: rake test
working-directory: ${{ matrix.example }}

minutus-mrbgem-template:
name: run spec on minutus-mrbgem-template
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
script:
- ./test.sh
- ./test_with_dependency.sh
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- run: CLEAN=true rake run_all
ruby-version: "3.1"
- run: cargo clean && ${{ matrix.script }}
working-directory: minutus-mrbgem-template

aggregated-ci:
runs-on: ubuntu-latest
needs: [cargo_test, minutus-mrbgem-template, examples]
if: always()
steps:
- name: All tests ok
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
12 changes: 0 additions & 12 deletions Rakefile

This file was deleted.

3 changes: 3 additions & 0 deletions examples/custom-mruby-3_1_0/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task :test do
system("cargo clean && cargo run && cargo test", exception: true)
end
3 changes: 3 additions & 0 deletions examples/custom-mruby/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task :test do
system("cargo clean && cargo run && cargo test", exception: true)
end
2 changes: 1 addition & 1 deletion examples/mruby-polars/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ task :compile => :mruby do
end

desc "test"
task :test => :mruby do
task :test => [:mruby, :clean] do
sh "cd mruby && rake all test MRUBY_CONFIG=#{MRUBY_CONFIG}"
end

Expand Down
3 changes: 3 additions & 0 deletions examples/plain-mruby/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task :test do
system("cargo clean && cargo run && cargo test", exception: true)
end

0 comments on commit 70a7c23

Please sign in to comment.