From ce9bf1b17a4e73d57ec463344e3f9539cafced3b Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 13 Jun 2024 18:51:11 +1000 Subject: [PATCH] added lint tests --- .github/workflows/lint.yaml | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..ad10010 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,76 @@ +--- +name: "Unit Testing" + +on: + push: + branches: + - "*" + +jobs: + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + + steps: + - name: Checkout Source + uses: actions/checkout@v3 + if: ${{ github.repository_owner == 'benjamin-robertson' }} + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + if: ${{ github.repository_owner == 'benjamin-robertson' }} + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + if: ${{ github.repository_owner == 'benjamin-robertson' }} + run: | + echo ::group::bundler environment + bundle env + echo ::endgroup:: + + - name: Setup Integration Test Matrix + id: get-matrix + run: | + if [ '${{ github.repository_owner }}' == 'benjamin-robertson' ]; then + echo "matrix={'platform':['centos-stream8'],'collection':['puppet7-nightly', 'puppet8-nightly']}" >> $GITHUB_OUTPUT + else + echo "matrix={}" >> $GITHUB_OUTPUT + fi + + Unit: + needs: + - setup_matrix + if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} + + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} + + env: + PUPPET_GEM_VERSION: '~> 7.24' + FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set? + + steps: + - name: Checkout Source + uses: actions/checkout@v3 + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + run: | + echo ::group::bundler environment + bundle env + echo ::endgroup:: + + - name: "Run tests" + run: | + bundle exec rake lint \ No newline at end of file