lint: exclude vendor and bundled gems from puppet-lint and puppet-syntax #4
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
| --- | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: Run puppet-lint | |
| run: bundle exec rake lint --trace | |
| - name: Check metadata.json | |
| run: bundle exec rake metadata_lint | |
| syntax: | |
| name: Syntax | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| puppet: | |
| - '7' | |
| - '8' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: bundle install | |
| env: | |
| PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}" | |
| - name: Validate syntax | |
| run: bundle exec rake syntax | |
| env: | |
| PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}" | |
| unit: | |
| name: Unit Tests (Puppet ${{ matrix.puppet }}, Ruby ${{ matrix.ruby }}) | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| - syntax | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - puppet: '7' | |
| ruby: '2.7' | |
| - puppet: '7' | |
| ruby: '3.2' | |
| - puppet: '8' | |
| ruby: '3.2' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby ${{ matrix.ruby }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: bundle install | |
| env: | |
| PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}" | |
| - name: Run RSpec tests | |
| run: bundle exec rake spec | |
| env: | |
| PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}" | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| needs: unit | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: Run tests with coverage | |
| run: bundle exec rake spec | |
| env: | |
| COVERAGE: 'yes' | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage/.resultset.json | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| release: | |
| name: Release to Puppet Forge | |
| runs-on: ubuntu-latest | |
| needs: unit | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Build module | |
| run: | | |
| gem install puppet-blacksmith | |
| rake build | |
| - name: Publish to Forge | |
| run: rake module:push | |
| env: | |
| BLACKSMITH_FORGE_URL: https://forgeapi.puppet.com | |
| BLACKSMITH_FORGE_USERNAME: ${{ secrets.FORGE_USERNAME }} | |
| BLACKSMITH_FORGE_PASSWORD: ${{ secrets.FORGE_API_KEY }} |