ci: fix bundler issue in ruby 3.4 unit test #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ========================================================================= | |
| # Ceedling - Test-Centered Build System for C | |
| # ThrowTheSwitch.org | |
| # Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams | |
| # SPDX-License-Identifier: MIT | |
| # ========================================================================= | |
| --- | |
| # Continuous Integration Workflow | |
| name: CI | |
| # Triggers the workflow on push or pull request events for master & test branches | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| - 'test/**' | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| # Cancel in-progress runs when a new workflow with the same group name starts | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Needed by softprops/action-gh-release | |
| permissions: | |
| # Allow built gem file push to Github release | |
| contents: write | |
| jobs: | |
| # Job: Linux unit test suite | |
| unit-tests-linux: | |
| name: "Linux Test Suite" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ['3.3', '3.4'] | |
| steps: | |
| # Checks out repository under $GITHUB_WORKSPACE | |
| - name: Checkout Latest Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Setup Ruby with integrated bundler caching | |
| - name: Setup Ruby Version Matrix | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| # Workaround: fix Ruby toolcache gem dir permissions (Bundler exit 38) | |
| # Issue: https://github.com/rubygems/rubygems/issues/7983 | |
| - name: Fix Ruby toolcache gem directory permissions | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo chmod -R go-w /opt/hostedtoolcache/Ruby/**/**/lib/ruby/gems/**/gems || true | |
| # Cache system dependencies to speed up builds | |
| - name: Cache APT packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: /var/cache/apt/archives | |
| key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/main.yml') }} | |
| restore-keys: | | |
| apt-${{ runner.os }}- | |
| # Install Gem Dependencies (Bundler version should match the one in Gemfile.lock) | |
| - name: Install Gem Dependencies for Testing and Ceedling Gem Builds | |
| run: | | |
| gem install rubocop -v 0.57.2 | |
| gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" | |
| bundle install --jobs 4 --retry 3 | |
| # Cache pip packages | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ runner.os }}-${{ hashFiles('.github/workflows/main.yml') }} | |
| restore-keys: | | |
| pip-${{ runner.os }}- | |
| # Install system dependencies and tools | |
| - name: Install System Dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install --assume-yes --quiet gdb | |
| # Install Python tools for Gcov plugin | |
| - name: "Install Python Tools for Ceedling Plugin: Gcov" | |
| run: | | |
| python3 -m pip install --upgrade pip setuptools wheel | |
| python3 -m pip install --user gcovr | |
| # Install .NET ReportGenerator for Gcov plugin | |
| # Fix PATH before tool installation | |
| # https://stackoverflow.com/questions/59010890/github-action-how-to-restart-the-session | |
| - name: "Install ReportGenerator for Tests of Ceedling Plugin: Gcov" | |
| run: | | |
| mkdir --parents $HOME/.dotnet/tools | |
| echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | |
| dotnet tool install --global dotnet-reportgenerator-globaltool | |
| # Run Tests | |
| - name: Run All Self Tests | |
| run: rake ci | |
| # Build & Install Ceedling Gem | |
| - name: Build and Install Ceedling Gem | |
| run: | | |
| gem build ceedling.gemspec | |
| gem install --local ceedling-*.gem | |
| # Run temp_sensor example project | |
| - name: Run Tests on temp_sensor Project | |
| working-directory: examples/temp_sensor | |
| run: ceedling test:all | |
| # Run FFF Plugin Tests | |
| - name: "Run Tests on Ceedling Plugin: FFF" | |
| working-directory: plugins/fff | |
| run: rake | |
| # Run Module Generator Plugin Tests | |
| - name: "Run Tests on Ceedling Plugin: Module Generator" | |
| working-directory: plugins/module_generator | |
| run: rake | |
| # Run Dependencies Plugin Tests | |
| - name: "Run Tests on Ceedling Plugin: Dependencies" | |
| working-directory: plugins/dependencies | |
| run: rake | |
| # Upload test artifacts on failure | |
| - name: Upload Test Artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-ruby-${{ matrix.ruby }} | |
| path: | | |
| **/build/ | |
| **/logs/ | |
| retention-days: 7 |