Updated provider version #197
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go Build | |
| 'on': | |
| workflow_dispatch: {} | |
| push: | |
| paths-ignore: | |
| - '.github/workflows/*' | |
| pull_request: {} | |
| jobs: | |
| tests: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| parallel: [10] | |
| index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| - name: Download JUnit Summary from Previous Workflow | |
| id: download-artifact | |
| uses: dawidd6/action-download-artifact@v2 | |
| with: | |
| workflow_conclusion: success | |
| name: junit-test-summary | |
| if_no_artifact_found: warn | |
| branch: main | |
| - name: Split integration tests | |
| id: test_split | |
| uses: hashicorp-forge/go-test-split-action@v1 | |
| with: | |
| index: ${{ matrix.index }} | |
| total: ${{ matrix.parallel }} | |
| junit-summary: ./junit-test-summary.xml | |
| - name: Install Terraform | |
| uses: hashicorp/setup-terraform@v2 | |
| with: | |
| terraform_wrapper: false | |
| - name: Clone the Terraform provider source | |
| run: git clone https://github.com/OctopusDeployLabs/terraform-provider-octopusdeploy.git | |
| shell: bash | |
| - name: Build the Terraform provider from source | |
| run: go build -o terraform-provider-octopusdeploy | |
| working-directory: terraform-provider-octopusdeploy | |
| - name: Override the location used by Terraform provider | |
| run: |- | |
| cat <<EOT >> ~/.terraformrc | |
| provider_installation { | |
| dev_overrides { | |
| "octopusdeploylabs/octopusdeploy" = "${{ github.workspace }}/terraform-provider-octopusdeploy" | |
| } | |
| direct {} | |
| } | |
| EOT | |
| - name: Go test | |
| shell: bash | |
| env: | |
| # Set this to a base64 encoded Octopus license. It is passed to the Octopus docker image, which requires an | |
| # encoded license. | |
| LICENSE: ${{ secrets.LICENSE }} | |
| # Reuse any Terraform plugins between tests | |
| TF_PLUGIN_CACHE_DIR: ${{ github.workspace }} | |
| OCTOTESTDUMPSTATE: !!str true | |
| OCTOTESTDEFAULTSPACEID: Spaces-2 | |
| TEST_GIT_REPO: ${{ secrets.TEST_GIT_REPO }} | |
| TEST_GIT_PASSWORD: ${{ secrets.GIT_CREDENTIAL }} | |
| TEST_GIT_USERNAME: ${{ secrets.TEST_GIT_USERNAME }} | |
| GOMAXPROCS: 2 | |
| OCTOTESTRETRYCOUNT: 5 | |
| TESTCONTAINERS_RYUK_DISABLED: true | |
| run: | | |
| GOBIN=$PWD/bin go install gotest.tools/gotestsum@latest | |
| ./bin/gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test_split.outputs.run }}" -timeout 0 ./... | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: junit-test-summary-${{ matrix.index }} | |
| path: node-summary.xml | |
| retention-days: 1 | |
| tests-combine-summaries: | |
| name: Combine Test Reports | |
| needs: [ tests ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v3 | |
| - name: Install junit-report-merger | |
| run: npm install -g junit-report-merger | |
| - name: Merge reports | |
| run: > | |
| jrm ./junit-test-summary.xml | |
| "junit-test-summary-0/*.xml" | |
| "junit-test-summary-1/*.xml" | |
| "junit-test-summary-2/*.xml" | |
| "junit-test-summary-3/*.xml" | |
| "junit-test-summary-4/*.xml" | |
| "junit-test-summary-5/*.xml" | |
| "junit-test-summary-6/*.xml" | |
| "junit-test-summary-7/*.xml" | |
| "junit-test-summary-8/*.xml" | |
| "junit-test-summary-9/*.xml" | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: junit-test-summary | |
| path: ./junit-test-summary.xml | |
| - name: Report | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Go Tests | |
| path: junit-test-summary.xml | |
| reporter: java-junit | |
| fail-on-error: 'true' | |
| build: | |
| needs: [ tests-combine-summaries ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: '0' | |
| - name: Get branch name | |
| id: branch-name | |
| uses: tj-actions/branch-names@v7 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| versionSpec: 5.x | |
| - name: Install Terraform | |
| uses: hashicorp/setup-terraform@v2 | |
| with: | |
| terraform_wrapper: false | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| versionSpec: 5.x | |
| - id: determine_version | |
| name: Determine Version | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| additionalArguments: /overrideconfig mode=Mainline | |
| - name: Install Octopus Deploy CLI | |
| uses: OctopusDeploy/install-octopus-cli-action@v1 | |
| with: | |
| version: latest | |
| - name: Install Dependencies | |
| run: go get ./... | |
| shell: bash | |
| - name: List Dependencies | |
| run: go list -m all > dependencies.txt | |
| shell: bash | |
| - name: Collect Dependencies | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: Dependencies | |
| path: dependencies.txt | |
| # - name: List Dependency Updates | |
| # run: go list -u -m -f "{{if .Update}}{{.}}{{end}}" all > dependencyUpdates.txt | |
| # shell: bash | |
| # - name: Collect Dependency Updates | |
| # uses: actions/upload-artifact@v2 | |
| # with: | |
| # name: Dependencies Updates | |
| # path: dependencyUpdates.txt | |
| - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octolint_linux_amd64 cmd/octolint.go | |
| env: | |
| GOOS: linux | |
| GOARCH: amd64 | |
| CGO_ENABLED: 0 | |
| - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octolint_windows_amd64.exe cmd/octolint.go | |
| env: | |
| GOOS: windows | |
| GOARCH: amd64 | |
| CGO_ENABLED: 0 | |
| - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octolint_macos_arm64 cmd/octolint.go | |
| env: | |
| GOOS: darwin | |
| GOARCH: arm64 | |
| CGO_ENABLED: 0 | |
| - id: create_release | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }} | |
| title: Release ${{ steps.determine_version.outputs.semVer }} Run ${{ github.run_number }} Attempt ${{ github.run_attempt }} | |
| draft: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }} | |
| prerelease: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }} | |
| - name: Upload Linux Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: octolint_linux_amd64 | |
| asset_name: octolint_linux_amd64 | |
| asset_content_type: application/octet-stream | |
| - name: Upload Windows Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: octolint_windows_amd64.exe | |
| asset_name: octolint_windows_amd64.exe | |
| asset_content_type: application/octet-stream | |
| - name: Upload macOS Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: octolint_macos_arm64 | |
| asset_name: octolint_macos_arm64 | |
| asset_content_type: application/octet-stream | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push latest | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: octopussamples/octolint-linux:latest | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push versioned image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: octopussamples/octolint-linux:${{ steps.determine_version.outputs.semVer }} | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push latest arm64 | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| platforms: arm64 | |
| tags: octopussamples/octolint-linux-arm64:latest | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push versioned image arm64 | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| platforms: arm64 | |
| tags: octopussamples/octolint-linux-arm64:${{ steps.determine_version.outputs.semVer }} | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: https://ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push latest | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: ghcr.io/octopussolutionsengineering/octolint-linux:latest | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push versioned image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: ghcr.io/octopussolutionsengineering/octolint-linux:${{ steps.determine_version.outputs.semVer }} | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push latest arm64 | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| platforms: arm64 | |
| tags: ghcr.io/octopussolutionsengineering/octolint-linux-arm64:latest | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push versioned image arm64 | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| platforms: arm64 | |
| tags: ghcr.io/octopussolutionsengineering/octolint-linux-arm64:${{ steps.determine_version.outputs.semVer }} | |
| build-args: Version=${{ steps.determine_version.outputs.semVer }} | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: '0' | |
| - name: Get branch name | |
| id: branch-name | |
| uses: tj-actions/branch-names@v7 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| versionSpec: 5.x | |
| - id: determine_version | |
| name: Determine Version | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| additionalArguments: /overrideconfig mode=Mainline | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octolint_windows_amd64.exe cmd/octolint.go | |
| env: | |
| GOOS: windows | |
| GOARCH: amd64 | |
| CGO_ENABLED: 0 | |
| - name: Build and push latest | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2019 -t octopussamples/octolint-windows-2019:latest | |
| docker push octopussamples/octolint-windows-2019:latest | |
| - name: Build and push | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2019 -t octopussamples/octolint-windows-2019:${{ steps.determine_version.outputs.semVer }} | |
| docker push octopussamples/octolint-windows-2019:${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push latest 2022 | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2022 -t octopussamples/octolint-windows-2022:latest | |
| docker push octopussamples/octolint-windows-2022:latest | |
| - name: Build and push | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2022 -t octopussamples/octolint-windows-2022:${{ steps.determine_version.outputs.semVer }} | |
| docker push octopussamples/octolint-windows-2022:${{ steps.determine_version.outputs.semVer }} | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: https://ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push latest | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2019 -t ghcr.io/octopussolutionsengineering/octolint-windows-2019:latest | |
| docker push ghcr.io/octopussolutionsengineering/octolint-windows-2019:latest | |
| - name: Build and push | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2019 -t ghcr.io/octopussolutionsengineering/octolint-windows-2019:${{ steps.determine_version.outputs.semVer }} | |
| docker push ghcr.io/octopussolutionsengineering/octolint-windows-2019:${{ steps.determine_version.outputs.semVer }} | |
| - name: Build and push latest 2022 | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2022 -t ghcr.io/octopussolutionsengineering/octolint-windows-2022:latest | |
| docker push ghcr.io/octopussolutionsengineering/octolint-windows-2022:latest | |
| - name: Build and push | |
| if: ${{ steps.branch-name.outputs.current_branch == 'main' }} | |
| run: | | |
| docker build --platform windows/amd64 . -f Dockerfile.windows2022 -t ghcr.io/octopussolutionsengineering/octolint-windows-2022:${{ steps.determine_version.outputs.semVer }} | |
| docker push ghcr.io/octopussolutionsengineering/octolint-windows-2022:${{ steps.determine_version.outputs.semVer }} | |
| multiarch-image: | |
| needs: [ build-windows, build ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Create manifest | |
| run: > | |
| docker run -v $PWD:/build mplatform/manifest-tool | |
| --username=${{ secrets.DOCKERHUB_USERNAME }} | |
| --password=${{ secrets.DOCKERHUB_TOKEN }} | |
| push from-spec /build/manifest-octolint.yaml | |
| - name: Create manifest GHCR | |
| run: > | |
| docker run -v $PWD:/build mplatform/manifest-tool | |
| --username=${{ github.actor }} | |
| --password=${{ secrets.GITHUB_TOKEN }} | |
| push from-spec /build/manifest-octolint-ghcr.yaml | |
| permissions: | |
| id-token: write | |
| checks: write | |
| contents: write | |
| packages: write |