From 22d5d8cd30ecaef8bd272ff3c81834f47c555f91 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 18 Jun 2024 15:39:52 -0500 Subject: [PATCH] Update lint-unit.yml (#13) Add checks to skip tests that require Gemfile and no gemfile exists in the repo Add googleapis/release-please-action pulish.yml workflow --------- Signed-off-by: Corey Hemminger --- .github/workflows/ci.yml | 9 +++++++++ .github/workflows/lint-unit.yml | 35 ++++++++++++++++++++++++--------- .github/workflows/publish.yaml | 15 ++++++++++++++ .markdownlint.yaml | 4 ++++ .mdlrc | 1 - .release-please-manifest.json | 3 +++ CHANGELOG.md | 1 + release-please-config.json | 10 ++++++++++ 8 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yaml create mode 100644 .markdownlint.yaml delete mode 100644 .mdlrc create mode 100644 .release-please-manifest.json create mode 100644 CHANGELOG.md create mode 100644 release-please-config.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..11c822f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,9 @@ +--- +name: Lint & Unit + +"on": + pull_request: + +jobs: + lint-unit: + uses: ./.github/workflows/lint-unit.yml diff --git a/.github/workflows/lint-unit.yml b/.github/workflows/lint-unit.yml index 1bf063d..d99cefb 100644 --- a/.github/workflows/lint-unit.yml +++ b/.github/workflows/lint-unit.yml @@ -1,10 +1,11 @@ +--- name: Lint & Unit test "on": workflow_call: inputs: bundle_with: - description: "Bundle with option for Chefstyle, chose the bundler group that Chefstyle is in" + description: "Chose the bundler group name that Chefstyle is in" type: "string" required: false default: "chefstyle" @@ -22,20 +23,28 @@ jobs: strategy: matrix: ruby: ["3.3"] - name: Chefstyle on Ruby ${{ matrix.ruby }} + name: Chefstyle on Ruby steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Check for Gemfile + id: check + run: | + if [ -f Gemfile ]; then + echo "gemfile=true" >> $GITHUB_OUTPUT + else + echo "gemfile=false" >> $GITHUB_OUTPUT + fi - name: Setup Ruby + if: steps.check.outputs.gemfile == 'true' uses: ruby/setup-ruby@v1.180.1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: r7kamura/rubocop-problem-matchers-action@v1 - + if: steps.check.outputs.gemfile == 'true' - name: Chef Style + if: steps.check.outputs.gemfile == 'true' run: bundle exec chefstyle yamllint: @@ -59,9 +68,9 @@ jobs: globs: "**/*.md" test: - name: Unit Test with Ruby ${{ matrix.ruby }} + name: Unit Test with Ruby runs-on: ubuntu-latest - needs: [markdown-lint, yamllint, chefstyle] + needs: [yamllint, chefstyle] env: BUNDLE_WITHOUT: ${{ inputs.bundle_without }} strategy: @@ -70,12 +79,20 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Check for Gemfile + id: check + run: | + if [ -f Gemfile ]; then + echo "gemfile=true" >> $GITHUB_OUTPUT + else + echo "gemfile=false" >> $GITHUB_OUTPUT + fi - name: Setup Ruby + if: steps.check.outputs.gemfile == 'true' uses: ruby/setup-ruby@v1.180.1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Rake Test + if: steps.check.outputs.gemfile == 'true' run: bundle exec rake test diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..fae04f3 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,15 @@ +--- +name: release-please + +"on": + push: + branches: [main] + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.PORTER_GITHUB_TOKEN }} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..7d92cf5 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,4 @@ +--- +default: true +MD013: false +MD041: false diff --git a/.mdlrc b/.mdlrc deleted file mode 100644 index 4a99ce4..0000000 --- a/.mdlrc +++ /dev/null @@ -1 +0,0 @@ -rules "~MD013", "~MD036" \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..2be9c43 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.2.0" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a0cf709 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +# CHANGELOG diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..3801c0e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,10 @@ +{ + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "release-type": "simple", + "include-component-in-tag": false, + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}