diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 6cdeabb8..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# This is a comment. -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default owners for everything in -# the repo. Unless a later match takes precedence, -# @global-owner1 and @global-owner2 will be requested for -# review when someone opens a pull request. -* @jpogran @glennsarti @puppetlabs/devx diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6ac3b5e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: "ci" + +on: + pull_request: + branches: + - "main" + workflow_dispatch: + +jobs: + + spec: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + runs_on: + - 'ubuntu-latest' + - 'windows-latest' + + name: "Spec : ${{ matrix.runs_on }} Ruby ${{ matrix.ruby_version }}" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + runs_on: ${{ matrix.runs_on }} + rake_task: 'gem_revendor test_languageserver test_languageserver_sidecar test_debugserver' + + acceptance: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + runs_on: + - 'ubuntu-latest' + - 'windows-latest' + + name: "Acceptance : ${{ matrix.runs_on }} Ruby ${{ matrix.ruby_version }}" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_acceptance.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + runs_on: ${{ matrix.runs_on }} + rake_task: 'gem_revendor acceptance_languageserver' + + build: + name: "Build Editor Service" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Set build version + shell: pwsh + run: | + '99.99.0-gh.${{ github.run_number }}' | Out-File -FilePath 'lib\puppet_editor_services\VERSION' -Encoding ASCII -Confirm:$false -Force + - name: Run rake gem_revendor build + run: bundle exec rake gem_revendor build + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: puppet-editor-services + path: output/*.zip + retention-days: 2 diff --git a/.github/workflows/editor-services-ci.yml b/.github/workflows/editor-services-ci.yml deleted file mode 100644 index 3e65be90..00000000 --- a/.github/workflows/editor-services-ci.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Editor Services CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - matrix: - name: Generate test matrix - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v2 - - id: set-matrix - shell: pwsh - # Use a small PowerShell script to generate the test matrix - run: "& .github/workflows/create-test-matrix.ps1" - - run-tests: - needs: [matrix] - strategy: - fail-fast: false - matrix: - cfg: ${{ fromJson(needs.matrix.outputs.matrix) }} - name: "${{ matrix.cfg.job_name }} : Ruby ${{ matrix.cfg.ruby }} on ${{ matrix.cfg.os }}" - runs-on: ${{ matrix.cfg.os }} - env: - PUPPET_GEM_VERSION: ${{ matrix.cfg.puppet_gem_version }} - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.cfg.ruby }} - bundler-cache: true - - name: Update Ruby Gems - shell: pwsh - # Update rubygems to latest if it's using an old version ( < 3.x) - run: | - if ((& gem -v) -match '^(1|2)\.') { - Write-Host '::group::Upgrade Ruby Gems' - gem update --system - Write-Host '::endgroup' - } else { - Write-Host "No need to update rubygems" - } - - name: Test environment information - shell: pwsh - run: | - Write-Host '--- Ruby version' - & ruby -v - Write-Host '--- Gem version' - & gem -v - Write-Host '--- Bundler version' - & bundle -v - Write-Host '--- Gem lock file contents' - Get-Content Gemfile.lock -Raw - Write-Host '--- Puppet version' - & bundle exec puppet --version - - name: Run rake ${{ matrix.cfg.rake_tasks }} - # To enable debug messages for the Acceptance Tests - # env: - # SPEC_DEBUG: 'true' - run: bundle exec rake ${{ matrix.cfg.rake_tasks }} - - build: - needs: [run-tests] - name: "Build Editor Service" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Set build version - shell: pwsh - run: | - '99.99.0-gh.${{ github.run_number }}' | Out-File -FilePath 'lib\puppet_editor_services\VERSION' -Encoding ASCII -Confirm:$false -Force - - name: Run rake gem_revendor build - run: bundle exec rake gem_revendor build - - name: 'Upload Artifact' - uses: actions/upload-artifact@v2 - with: - name: puppet-editor-services - path: output/*.zip - retention-days: 2 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..e6684602 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,68 @@ +name: "nightly" + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + + spec: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + runs_on: + - 'ubuntu-latest' + - 'windows-latest' + + name: "Spec : ${{ matrix.runs_on }} Ruby ${{ matrix.ruby_version }}" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + runs_on: ${{ matrix.runs_on }} + rake_task: 'gem_revendor test_languageserver test_languageserver_sidecar test_debugserver' + + acceptance: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + runs_on: + - 'ubuntu-latest' + - 'windows-latest' + + name: "Acceptance : ${{ matrix.runs_on }} Ruby ${{ matrix.ruby_version }}" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_acceptance.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + runs_on: ${{ matrix.runs_on }} + rake_task: 'gem_revendor acceptance_languageserver' + + build: + name: "Build Editor Service" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Set build version + shell: pwsh + run: | + '99.99.0-gh.${{ github.run_number }}' | Out-File -FilePath 'lib\puppet_editor_services\VERSION' -Encoding ASCII -Confirm:$false -Force + - name: Run rake gem_revendor build + run: bundle exec rake gem_revendor build + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: puppet-editor-services + path: output/*.zip + retention-days: 2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..97988a91 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: "release" + +on: + workflow_call: + inputs: + target: + description: "The target for the release. This can be a commit sha or a branch." + required: false + default: "main" + type: "string" + +jobs: + release: + name: "Release" + runs-on: "ubuntu-latest" + if: github.repository_owner == 'puppetlabs' + + steps: + + - name: "Checkout" + uses: "actions/checkout@v3" + with: + ref: ${{ github.event.inputs.target }} + clean: true + fetch-depth: 0 + + - name: "Setup ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "2.7" + bundler-cache: "true" + + - name: "Bundle environment" + run: | + echo ::group::bundler environment + bundle env + echo ::endgroup:: + - name: "Get version" + id: "get_version" + run: | + echo "version=$(ruby -e "require 'rubygems'; puts Gem::Specification::load(Dir.glob('*.gemspec').first).version.to_s")" >> $GITHUB_OUTPUT + - name: "Build" + run: | + bundle exec rake build + - name: "Create release" + run: | + gh release create v${{ steps.get_version.outputs.version }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_prep.yml b/.github/workflows/release_prep.yml new file mode 100644 index 00000000..be3080f7 --- /dev/null +++ b/.github/workflows/release_prep.yml @@ -0,0 +1,20 @@ +name: "release prep" + +on: + workflow_dispatch: + inputs: + target: + description: "The target for the release. This can be a commit sha or a branch." + required: false + default: "main" + version: + description: "Version of gem to be released." + required: true + +jobs: + release_prep: + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main" + with: + target: "${{ github.event.inputs.target }}" + version: "${{ github.events.inputs.version }}" + secrets: "inherit" diff --git a/Gemfile b/Gemfile index 52e76ed9..b0617616 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,9 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development do gem 'rake', '>= 10.4', :require => false gem 'rspec', '>= 3.2', :require => false + gem 'puppet-lint', '~> 3.3', :require => false + gem 'puppetfile-resolver', '~> 0.6.2', :require => false + gem 'yard', '~> 0.9.28', :require => false gem "rubocop", '= 1.6.1', require: false gem "rubocop-performance", '= 1.9.1', require: false