diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c653d1e8..cf556ea5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,11 +6,10 @@ # ========================================================================= --- -# Continuous Integration Workflow: Test case suite run + validation build check +# Continuous Integration Workflow name: CI -# Controls when the action will run. -# Triggers the workflow on push or pull request events but only for the master branch +# Triggers the workflow on push or pull request events for master & test branches on: push: branches: @@ -21,199 +20,206 @@ on: branches: [ master ] workflow_dispatch: -jobs: - # Job: Linux unit test suite - unit-tests-linux: - name: "Linux Unit Test Suite" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ruby: ['3.0', '3.1', '3.2'] - steps: - # Use a cache for our tools to speed up testing - - uses: actions/cache@v4 - with: - path: vendor/bundle - key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}- - - # Checks out repository under $GITHUB_WORKSPACE - - name: Checkout Latest Repo - uses: actions/checkout@v4 - with: - submodules: recursive - - # Setup Ruby Testing Tools to do tests on multiple ruby version - - name: Setup Ruby Testing Tools - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - # Install Ruby Testing Tools (Bundler version should match the one in Gemfile.lock) - - name: Install Ruby Testing Tools - run: | - gem install rspec - gem install rubocop -v 0.57.2 - gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" - bundle update - bundle install - - # Install gdb for backtrace feature testing - - name: Install gdb for Backtrace Feature Testing - run: | - sudo apt-get update -qq - sudo apt-get install --assume-yes --quiet gdb - - # Install GCovr for Gcov plugin - - name: Install GCovr for Gcov Plugin Tests - run: | - sudo pip install gcovr - - # Install 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 Gcov Plugin Tests - 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 Gem - - name: Build and Install Gem - run: | - gem build ceedling.gemspec - gem install --local ceedling-*.gem - # Run temp_sensor - - name: Run Tests on temp_sensor Project - run: | - cd examples/temp_sensor - ceedling test:all - cd ../.. +# Needed by softprops/action-gh-release +permissions: + # Allow built gem file push to Github release + contents: write - # Run FFF Plugin Tests - - name: Run Tests on FFF Plugin - run: | - cd plugins/fff - rake - cd ../.. - - # Run Module Generator Plugin Tests - - name: Run Tests on Module Generator Plugin - run: | - cd plugins/module_generator - rake - cd ../.. - # Run Dependencies Plugin Tests - - name: Run Tests on Dependency Plugin - run: | - cd plugins/dependencies - rake - cd ../.. - - # Job: Windows unit test suite - unit-tests-windows: - name: "Windows Unit Test Suite" - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - ruby: ['3.0', '3.1', '3.2'] - steps: - # Use a cache for our tools to speed up testing - - uses: actions/cache@v4 - with: - path: vendor/bundle - key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}- - - # Checks out repository under $GITHUB_WORKSPACE - - name: Checkout Latest Repo - uses: actions/checkout@v4 - with: - submodules: recursive - - # Setup Ruby Testing Tools to do tests on multiple ruby version - - name: Set Up Ruby Testing Tools - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} +jobs: + # # Job: Linux unit test suite + # unit-tests-linux: + # name: "Linux Test Suite" + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # ruby: ['3.0', '3.1', '3.2'] + # steps: + # # Use a cache for our tools to speed up testing + # - uses: actions/cache@v4 + # with: + # path: vendor/bundle + # key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} + # restore-keys: | + # bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}- + + # # Checks out repository under $GITHUB_WORKSPACE + # - name: Checkout Latest Repo + # uses: actions/checkout@v4 + # with: + # submodules: recursive + + # # Setup Ruby Testing Tools to do tests on multiple ruby version + # - name: Setup Ruby Testing Tools + # uses: ruby/setup-ruby@v1 + # with: + # ruby-version: ${{ matrix.ruby }} - # Install Ruby Testing Tools - # Bundler version should match the one in Gemfile.lock - - name: Install Ruby Testing Tools - shell: bash - run: | - gem install rspec - gem install rubocop -v 0.57.2 - gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" - bundle update - bundle install - - # Install GCovr for Gcov plugin test - - name: Install GCovr for Gcov Plugin Tests - run: | - pip install gcovr - - # Install ReportGenerator for Gcov plugin test - - name: Install ReportGenerator for Gcov Plugin Tests - run: | - dotnet tool install --global dotnet-reportgenerator-globaltool - - # Run Tests - - name: Run All Self Tests - run: | - rake ci - - # Build & Install Gem - - name: Build and Install Gem - run: | - gem build ceedling.gemspec - gem install --local ceedling-*.gem - - # Run temp_sensor example project - - name: Run Tests on temp_sensor Project - run: | - cd examples/temp_sensor - ceedling test:all - cd ../.. - - # Run FFF Plugin Tests - - name: Run Tests on FFF Plugin - run: | - cd plugins/fff - rake - cd ../.. - - # Run Module Generator Plugin Tests - - name: Run Tests on Module Generator Plugin - run: | - cd plugins/module_generator - rake - cd ../.. - - # Run Dependencies Plugin Tests - - name: Run Tests on Dependency Plugin - run: | - cd plugins/dependencies - rake - cd ../.. + # # Install Ruby Testing Tools (Bundler version should match the one in Gemfile.lock) + # - name: Install Ruby Testing Tools + # run: | + # gem install rspec + # gem install rubocop -v 0.57.2 + # gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" + # bundle update + # bundle install + + # # Install gdb for backtrace feature testing + # - name: Install gdb for Backtrace Feature Testing + # run: | + # sudo apt-get update -qq + # sudo apt-get install --assume-yes --quiet gdb + + # # Install GCovr for Gcov plugin + # - name: Install GCovr for Gcov Plugin Tests + # run: | + # sudo pip install gcovr + + # # Install 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 Gcov Plugin Tests + # 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 Gem + # - name: Build and Install Gem + # run: | + # gem build ceedling.gemspec + # gem install --local ceedling-*.gem + + # # Run temp_sensor + # - name: Run Tests on temp_sensor Project + # run: | + # cd examples/temp_sensor + # ceedling test:all + # cd ../.. + + # # Run FFF Plugin Tests + # - name: Run Tests on FFF Plugin + # run: | + # cd plugins/fff + # rake + # cd ../.. + + # # Run Module Generator Plugin Tests + # - name: Run Tests on Module Generator Plugin + # run: | + # cd plugins/module_generator + # rake + # cd ../.. + + # # Run Dependencies Plugin Tests + # - name: Run Tests on Dependency Plugin + # run: | + # cd plugins/dependencies + # rake + # cd ../.. + + # # Job: Windows unit test suite + # unit-tests-windows: + # name: "Windows Test Suite" + # runs-on: windows-latest + # strategy: + # fail-fast: false + # matrix: + # ruby: ['3.0', '3.1', '3.2'] + # steps: + # # Use a cache for our tools to speed up testing + # - uses: actions/cache@v4 + # with: + # path: vendor/bundle + # key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} + # restore-keys: | + # bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}- + + # # Checks out repository under $GITHUB_WORKSPACE + # - name: Checkout Latest Repo + # uses: actions/checkout@v4 + # with: + # submodules: recursive + + # # Setup Ruby Testing Tools to do tests on multiple ruby version + # - name: Set Up Ruby Testing Tools + # uses: ruby/setup-ruby@v1 + # with: + # ruby-version: ${{ matrix.ruby }} + + # # Install Ruby Testing Tools + # # Bundler version should match the one in Gemfile.lock + # - name: Install Ruby Testing Tools + # shell: bash + # run: | + # gem install rspec + # gem install rubocop -v 0.57.2 + # gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" + # bundle update + # bundle install + + # # Install GCovr for Gcov plugin test + # - name: Install GCovr for Gcov Plugin Tests + # run: | + # pip install gcovr + + # # Install ReportGenerator for Gcov plugin test + # - name: Install ReportGenerator for Gcov Plugin Tests + # run: | + # dotnet tool install --global dotnet-reportgenerator-globaltool + + # # Run Tests + # - name: Run All Self Tests + # run: | + # rake ci + + # # Build & Install Gem + # - name: Build and Install Gem + # run: | + # gem build ceedling.gemspec + # gem install --local ceedling-*.gem + + # # Run temp_sensor example project + # - name: Run Tests on temp_sensor Project + # run: | + # cd examples/temp_sensor + # ceedling test:all + # cd ../.. + + # # Run FFF Plugin Tests + # - name: Run Tests on FFF Plugin + # run: | + # cd plugins/fff + # rake + # cd ../.. + + # # Run Module Generator Plugin Tests + # - name: Run Tests on Module Generator Plugin + # run: | + # cd plugins/module_generator + # rake + # cd ../.. + + # # Run Dependencies Plugin Tests + # - name: Run Tests on Dependency Plugin + # run: | + # cd plugins/dependencies + # rake + # cd ../.. # Job: Automatic Minor Release auto-release: name: "Automatic Minor Release" - needs: - - unit-tests-linux - - unit-tests-windows + # needs: + # - unit-tests-linux + # - unit-tests-windows runs-on: ubuntu-latest strategy: matrix: @@ -226,8 +232,8 @@ jobs: with: submodules: recursive - # Setup Ruby Testing Tools to do tests on multiple ruby version - - name: Setup Ruby Testing Tools + # Set Up Ruby Tools + - name: Set Up Ruby Tools uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} @@ -246,7 +252,7 @@ jobs: gem build ceedling.gemspec # Create Unofficial Release - - name: Create Release + - name: Create Pre-Release uses: actions/create-release@v1 id: create_release with: @@ -258,13 +264,25 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - # Post Gem to Unofficial Release - - name: Upload Release Gem - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} + # # Post Gem to Unofficial Release + # - name: Upload Pre-Release Gem + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ./ceedling-${{ env.short_ver }}.gem + # asset_name: ceedling-${{ env.full_ver }}.gem + # asset_content_type: test/x-gemfile + + - name: Upload Pre-Release Gem + - uses: softprops/action-gh-release@v2 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./ceedling-${{ env.short_ver }}.gem - asset_name: ceedling-${{ env.full_ver }}.gem - asset_content_type: test/x-gemfile + # repo_token: "${{ secrets.GITHUB_TOKEN }}" + body: | + [Release Notes](${{ github.workspace }}/docs/ReleaseNotes.md) + name: ${{ env.full_ver }} + prerelease: true + files: | + *.gem +