diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml deleted file mode 100644 index 25e095be7..000000000 --- a/.github/workflows/build-pr.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: build-pr - -on: - pull_request: - branches-ignore: - - pre-release - -env: - GOPROXY: https://proxy.golang.org/ - -jobs: - generate-provider-schemas: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 - with: - go-version-file: ".go-version" - - name: Generate provider schemas - run: | - go generate ./internal/schemas - du -h -s ./internal/schemas/data - - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - { goos: "linux", goarch: "386" } - - { goos: "linux", goarch: "amd64" } - - { goos: "linux", goarch: "arm" } - - { goos: "linux", goarch: "arm64" } - - { goos: "freebsd", goarch: "386" } - - { goos: "freebsd", goarch: "amd64" } - - { goos: "freebsd", goarch: "arm" } - - { goos: "openbsd", goarch: "386" } - - { goos: "openbsd", goarch: "amd64" } - - { goos: "solaris", goarch: "amd64" } - - { goos: "windows", goarch: "386" } - - { goos: "windows", goarch: "amd64" } - - { goos: "windows", goarch: "arm64" } - - { goos: "darwin", goarch: "arm64" } - - { goos: "darwin", goarch: "amd64" } - timeout-minutes: 25 - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 - with: - go-version-file: ".go-version" - - name: ${{ matrix.goos }} ${{ matrix.goarch }} build - run: |- - go build \ - -trimpath \ - -buildvcs=false \ - -ldflags "-s -w" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 419d41365..ac2e94039 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,177 +1,57 @@ +--- name: build - on: push: - branches: - - main - - pre-release - -permissions: - actions: write - + branches: [main] + pull_request: + branches-ignore: [pre-release] env: - PKG_NAME: "opentofu-ls" - + GOPROXY: https://proxy.golang.org/ jobs: - get-go-version: - name: "Determine Go toolchain version" - runs-on: ubuntu-latest - outputs: - go-version: ${{ steps.get-go-version.outputs.go-version }} - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Determine Go version - id: get-go-version - # We use .go-version as our source of truth for current Go - # version, because "goenv" can react to it automatically. - run: | - echo "Building with Go $(cat .go-version)" - echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT - - set-product-version: - runs-on: ubuntu-latest - outputs: - product-version: ${{ steps.set-product-version.outputs.product-version }} - product-base-version: ${{ steps.set-product-version.outputs.base-product-version }} - product-prerelease-version: ${{ steps.set-product-version.outputs.prerelease-product-version }} - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set Product version - id: set-product-version - uses: hashicorp/actions-set-product-version@v1 - - generate-metadata-file: - needs: set-product-version - runs-on: ubuntu-latest - outputs: - filepath: ${{ steps.generate-metadata-file.outputs.filepath }} - steps: - - name: "Checkout directory" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Generate metadata file - id: generate-metadata-file - uses: hashicorp/actions-generate-metadata@v1 - with: - version: ${{ needs.set-product-version.outputs.product-version }} - product: ${{ env.PKG_NAME }} - repositoryOwner: "hashicorp" - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: metadata.json - path: ${{ steps.generate-metadata-file.outputs.filepath }} - generate-provider-schemas: runs-on: ubuntu-latest steps: - - name: "Checkout directory" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Go - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: - go-version-file: ".go-version" + go-version-file: .go-version - name: Generate provider schemas run: | go generate ./internal/schemas du -h -s ./internal/schemas/data - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: provider-schema-data - path: ./internal/schemas/data - retention-days: 1 - build: - needs: - - get-go-version - - set-product-version - - generate-provider-schemas runs-on: ubuntu-latest strategy: matrix: include: - - { goos: "linux", goarch: "386" } - - { goos: "linux", goarch: "amd64" } - - { goos: "linux", goarch: "arm" } - - { goos: "linux", goarch: "arm64" } - - { goos: "freebsd", goarch: "386" } - - { goos: "freebsd", goarch: "amd64" } - - { goos: "freebsd", goarch: "arm" } - - { goos: "openbsd", goarch: "386" } - - { goos: "openbsd", goarch: "amd64" } - - { goos: "solaris", goarch: "amd64" } - - { goos: "windows", goarch: "386" } - - { goos: "windows", goarch: "amd64" } - - { goos: "windows", goarch: "arm64" } - - { goos: "darwin", goarch: "arm64" } - - { goos: "darwin", goarch: "amd64" } - fail-fast: true - name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build + - {goos: linux, goarch: '386'} + - {goos: linux, goarch: amd64} + - {goos: linux, goarch: arm} + - {goos: linux, goarch: arm64} + - {goos: freebsd, goarch: '386'} + - {goos: freebsd, goarch: amd64} + - {goos: freebsd, goarch: arm} + - {goos: openbsd, goarch: '386'} + - {goos: openbsd, goarch: amd64} + - {goos: solaris, goarch: amd64} + - {goos: windows, goarch: '386'} + - {goos: windows, goarch: amd64} + - {goos: windows, goarch: arm64} + - {goos: darwin, goarch: arm64} + - {goos: darwin, goarch: amd64} + timeout-minutes: 25 steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Download provider schemas - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - name: provider-schema-data - path: ./internal/schemas/data - - name: Check provider schemas - run: du -h -s ./internal/schemas/data - - uses: hashicorp/actions-go-build@v0.1.9 - env: - BASE_VERSION: ${{ needs.set-product-version.outputs.product-base-version }} - PRERELEASE_VERSION: ${{ needs.set-product-version.outputs.product-prerelease-version}} - METADATA_VERSION: ${{ env.METADATA }} - CGO_ENABLED: 0 - with: - product_name: ${{ env.PKG_NAME }} - product_version: ${{ needs.set-product-version.outputs.product-version }} - go_version: ${{ needs.get-go-version.outputs.go-version }} - os: ${{ matrix.goos }} - arch: ${{ matrix.goarch }} - reproducible: report - instructions: |- - go build \ - -o "$BIN_PATH" \ - -trimpath \ - -buildvcs=false \ - -ldflags " - -s -w - -X 'main.algoliaAppID=${{ secrets.ALGOLIA_APP_ID }}' - -X 'main.algoliaAPIKey=${{ secrets.ALGOLIA_API_KEY }}' - " - - name: Package - if: ${{ matrix.goos == 'linux' }} - uses: hashicorp/actions-packaging-linux@v1 - with: - name: ${{ github.event.repository.name }} - description: "Terraform Language Server" - arch: ${{ matrix.goarch }} - version: ${{ needs.set-product-version.outputs.product-version }} - maintainer: "HashiCorp" - homepage: "https://github.com/gamunu/opentofu-ls" - license: "MPL-2.0" - binary: "dist/${{ env.PKG_NAME }}" - deb_depends: "openssl" - rpm_depends: "openssl" - - name: Set Package Names - if: ${{ matrix.goos == 'linux' }} - run: | - echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV - echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ matrix.goos == 'linux' }} - with: - name: ${{ env.RPM_PACKAGE }} - path: out/${{ env.RPM_PACKAGE }} - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ matrix.goos == 'linux' }} - with: - name: ${{ env.DEB_PACKAGE }} - path: out/${{ env.DEB_PACKAGE }} - - delete-provider-schemas: - needs: build - runs-on: ubuntu-latest - steps: - - uses: geekyeggo/delete-artifact@24928e75e6e6590170563b8ddae9fac674508aa1 # v5.0.0 - with: - name: provider-schema-data - token: ${{ github.token }} + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Set up Go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version-file: .go-version + - name: ${{ matrix.goos }} ${{ matrix.goarch }} build + run: |- + go build \ + -trimpath \ + -buildvcs=false \ + -ldflags "-s -w" diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index a3119fbc9..15eb46a92 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -1,13 +1,10 @@ -name: 'Lock Threads' - +name: Lock Threads permissions: issues: write pull-requests: write - on: schedule: - - cron: '0 3 * * *' - + - cron: 0 3 * * * jobs: lock: runs-on: ubuntu-latest @@ -15,12 +12,10 @@ jobs: - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 with: issue-comment: > - I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. + I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. - If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. issue-inactive-days: '30' pr-comment: > - I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. + I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. - If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. pr-inactive-days: '30' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d1bc035b..40650659e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,35 +1,56 @@ -name: Release - +name: release on: push: # run only against tags - tags: - - "*" - + tags: ['*'] jobs: + generate-provider-schemas: + runs-on: ubuntu-latest + steps: + - name: Checkout directory + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version-file: .go-version + - name: Generate provider schemas + run: | + go generate ./internal/schemas + du -h -s ./internal/schemas/data + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: provider-schema-data + path: ./internal/schemas/data + retention-days: 1 release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags) - - uses: actions/setup-go@v5 with: - go-version: stable - + go-version-file: .go-version - uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - - uses: sigstore/cosign-installer@v3.4.0 # installs cosign - - - uses: goreleaser/goreleaser-action@v5 # run goreleaser + - uses: sigstore/cosign-installer@v3.4.0 # installs cosign + - uses: goreleaser/goreleaser-action@v5 # run goreleaser with: version: latest args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + delete-provider-schemas: + needs: release + runs-on: ubuntu-latest + steps: + - uses: geekyeggo/delete-artifact@24928e75e6e6590170563b8ddae9fac674508aa1 # v5.0.0 + with: + name: provider-schema-data + token: ${{ github.token }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6b4052b60..80df1a051 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,43 +1,32 @@ -name: "Stale issues and pull requests" - +name: Stale issues and pull requests permissions: issues: write pull-requests: write - on: schedule: - - cron: "10 3 * * *" - + - cron: 10 3 * * * jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 - with: - only-labels: 'waiting-response' - - days-before-stale: 30 - stale-issue-label: 'stale' - stale-issue-message: | - Marking this issue as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label. - - Thank you for understanding. - stale-pr-label: 'stale' - stale-pr-message: | - Marking this pull request as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label. - - Thank you for understanding. - - days-before-close: 30 - close-issue-message: | - Closing this issue due to its staleness. - - If the issue was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context. - - Thank you! - close-pr-message: | - Closing this pull request due to its staleness. - - If the pull request was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context. - - Thank you! + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + with: + only-labels: waiting-response + days-before-stale: 30 + stale-issue-label: stale + stale-issue-message: | + Marking this issue as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label. + Thank you for understanding. + stale-pr-label: stale + stale-pr-message: | + Marking this pull request as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label. + Thank you for understanding. + days-before-close: 30 + close-issue-message: | + Closing this issue due to its staleness. + If the issue was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context. + Thank you! + close-pr-message: |- + Closing this pull request due to its staleness. + If the pull request was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context. + Thank you! diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea2206676..8e5a7858e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,10 @@ name: test - on: pull_request: push: - branches: - - main - + branches: [main] env: GOPROXY: https://proxy.golang.org/ - jobs: test: runs-on: ${{ matrix.os }} @@ -16,17 +12,14 @@ jobs: strategy: fail-fast: false matrix: - os: - - ubuntu-latest - - windows-latest - - macos-latest + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: - go-version-file: ".go-version" + go-version-file: .go-version - name: Go mod download run: go mod download -x - name: Go mod verify