Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Github Action to run validation and unit testing on PRs #140

Closed
timidri opened this issue Jan 13, 2021 · 0 comments
Closed

Add a Github Action to run validation and unit testing on PRs #140

timidri opened this issue Jan 13, 2021 · 0 comments

Comments

@timidri
Copy link
Contributor

timidri commented Jan 13, 2021

Example workflow:

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  spec:
    name: "Spec Tests"
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - puppet_ver: '~> 6'
            ruby_ver: 2.5
          - puppet_ver: '~> 7'
            ruby_ver: 2.7
    steps:
      - name: Checkout Source
        uses: actions/checkout@v2

      - name: Activate Ruby ${{ matrix.ruby_ver }}
        uses: ruby/setup-ruby@v1
        env:
          PUPPET_GEM_VERSION: ${{ matrix.puppet_ver }}
        with:
          ruby-version: ${{ matrix.ruby_ver }}
          bundler-cache: true

      - name: Print Bundler Environment
        env:
          PUPPET_GEM_VERSION: ${{ matrix.puppet_ver }}
        run: |
          bundle env

      - name: Code Validation
        env:
          PUPPET_GEM_VERSION: ${{ matrix.puppet_ver }}
        run: |
          bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint

      - name: Parallel Spec Tests
        env:
          PUPPET_GEM_VERSION: ${{ matrix.puppet_ver }}
        run: |
          bundle exec rake parallel_spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant