From 7db377061378f51a876dcf71636813f54493fb83 Mon Sep 17 00:00:00 2001 From: ydah Date: Wed, 1 Jan 2025 22:55:31 +0900 Subject: [PATCH] Add test job for multiple compilers for C This PR adds GitHub Actions jobs for multiple C language compilers. Specifically, it introduces tests for both cc and clang. --- .github/workflows/test.yaml | 19 +++++++++++++++++++ spec/lrama/integration_spec.rb | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index eda3f246..381e0a8d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -54,6 +54,25 @@ jobs: - run: flex --help - run: bundle install - run: bundle exec rspec + test-c: + needs: ruby-versions + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + ruby: ['head'] + compiler: ['cc', 'gcc', 'clang'] + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: flex --help + - run: bundle install + - run: bundle exec rspec + env: + COMPILER: ${{ matrix.compiler }} test-cpp: needs: ruby-versions runs-on: ubuntu-20.04 diff --git a/spec/lrama/integration_spec.rb b/spec/lrama/integration_spec.rb index 59feb261..4551d967 100644 --- a/spec/lrama/integration_spec.rb +++ b/spec/lrama/integration_spec.rb @@ -16,7 +16,7 @@ def compiler end def file_extension - ENV['COMPILER'] == "gcc" ? ".c" : ".cpp" + ['cc', 'gcc', 'clang'].include?(ENV['COMPILER']) ? ".c" : ".cpp" end def test_parser(parser_name, input, expected, expect_success: true, lrama_command_args: [], debug: false)