diff --git a/.github/workflows/build_azure_pipelinesrelease_template.yml b/.github/workflows/build_azure_pipelinesrelease_template.yml new file mode 100644 index 000000000..515827f45 --- /dev/null +++ b/.github/workflows/build_azure_pipelinesrelease_template.yml @@ -0,0 +1,207 @@ +# Environment variables defined in a calling workflow are not accessible to this reusable workflow. Refer to the documentation for further details on this limitation. +name: build_azure_pipelinesrelease_template +on: + workflow_call: + inputs: + goVersion: + required: false + default: 1.20.7 + type: string + registry: + required: false + default: ghcr.io/getporter/test + type: string + shouldPublish: + required: false + default: false + type: boolean + skipTests: + required: false + default: false + type: boolean +jobs: + Validate-build: + name: Native Compile + runs-on: "{{ vars.}}" + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Configure Agent + run: go run mage.go ConfigureAgent + - name: Native Build + run: mage build + shell: bash + - name: Publish Native Binaries + uses: actions/upload-artifact@v4.0.0 + with: + name: build-bin + path: "${{ github.workspace }}/bin" + Validate-xbuild: + name: Cross Compile + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Configure Agent + run: go run mage.go ConfigureAgent + - name: Cross Compile + run: mage XBuildAll + shell: bash + - name: Publish Release Binaries + uses: actions/upload-artifact@v4.0.0 + with: + name: xbuild-bin + path: "${{ github.workspace }}/bin" + Validate-VetLint: + name: Vet and Lint + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Configure Agent + run: go run mage.go ConfigureAgent + - name: Vet + run: mage Vet + shell: bash + - name: Lint + run: mage Lint + shell: bash + Validate-unit_test: + name: Unit Test + runs-on: ubuntu-latest + if: !(inputs.skipTests) + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Configure Agent + run: go run mage.go ConfigureAgent + - name: Unit Test + run: mage TestUnit + shell: bash + Validate-integration_test: + env: + GHCR_IOGETPORTER_DOCKER_REGISTRY: https://ghcr.io + GHCR_IOGETPORTER_DOCKER_USERNAME: getporterbot + name: Integration Test + needs: + - Validate-build + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Download Bin + uses: actions/download-artifact@v4.1.0 + with: + name: build-bin + path: bin + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: "${{ env.GHCR_IOGETPORTER_DOCKER_REGISTRY }}" + username: "${{ env.GHCR_IOGETPORTER_DOCKER_USERNAME }}" + password: "${{ secrets.GHCR_IOGETPORTER_DOCKER_PASSWORD }}" + - name: Configure Agent + run: go run mage.go ConfigureAgent SetBinExecutable + - name: Integration Test + run: mage -v TestIntegration + Validate-smoke_test: + name: Run smoke tests on + needs: + - Validate-xbuild + runs-on: + - self-hosted + if: success() && !(inputs.skipTests) + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Download Cross-Compiled Porter Binaries + uses: actions/download-artifact@v4.1.0 + with: + name: xbuild-bin + path: bin + - name: Setup Bin + run: go run mage.go ConfigureAgent UseXBuildBinaries + - name: Run Smoke Tests + run: mage -v TestSmoke + Publish-publish_binaries: + name: Publish Binaries + needs: + - Validate-build + - Validate-xbuild + - Validate-VetLint + - Validate-unit_test + - Validate-integration_test + - Validate-smoke_test + runs-on: ubuntu-latest + if: success() && inputs.shouldPublish + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Download Cross-Compiled Porter Binaries + uses: actions/download-artifact@v4.1.0 + with: + name: xbuild-bin + path: bin + - name: Setup Bin + run: go run mage.go ConfigureAgent UseXBuildBinaries + - name: Publish Porter Binaries + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + run: mage PublishPorter PublishMixins + Publish-publish_docker: + env: + DOCKER_REGISTRY: + DOCKER_USERNAME: + name: Publish Docker Images + needs: + - Validate-build + - Validate-xbuild + - Validate-VetLint + - Validate-unit_test + - Validate-integration_test + - Validate-smoke_test + runs-on: ubuntu-latest + if: success() && inputs.shouldPublish + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ inputs.GOVERSION }}" + - name: Download Cross-Compiled Porter Binaries + uses: actions/download-artifact@v4.1.0 + with: + name: xbuild-bin + path: bin + - name: Setup Bin + run: go run mage.go ConfigureAgent UseXBuildBinaries + # Unable to determine registry '${{parameters.registry}}' type. The service connection was not found or the authentication type not supported. + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: "${{ env.DOCKER_REGISTRY }}" + username: "${{ env.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + - name: Publish Docker Images to ${{inputs.registry}} + run: PORTER_REGISTRY=${{inputs.registry}} mage PublishImages diff --git a/.github/workflows/porter-canary.yml b/.github/workflows/porter-canary.yml new file mode 100644 index 000000000..b89303b79 --- /dev/null +++ b/.github/workflows/porter-canary.yml @@ -0,0 +1,27 @@ +name: porter/porter-canary +on: + workflow_dispatch: + inputs: + shouldPublish: + default: true + type: boolean + required: false + skipTests: + default: false + type: boolean + required: false + push: + branches: + - main + - release/* + pull_request: + branches: + - split-builds +jobs: + build_azure_pipelinesrelease_template: + name: build_azure_pipelinesrelease_template + uses: "./.github/workflows/build_azure_pipelinesrelease_template.yml" + with: + registry: ghcr.io/getporter + shouldPublish: "${{inputs.shouldPublish}}" + skipTests: "${{inputs.skipTests}}" diff --git a/.github/workflows/porter-install-check.yml b/.github/workflows/porter-install-check.yml new file mode 100644 index 000000000..1c0656cd5 --- /dev/null +++ b/.github/workflows/porter-install-check.yml @@ -0,0 +1,35 @@ +name: porter/porter-install-check +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + linux: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - name: Test Install Script + run: scripts/test/test-linux-install.sh + shell: bash + windows: + runs-on: windows-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - name: Test Install Script + run: scripts\test\test-windows-install.ps1 + shell: powershell + macos: + runs-on: + - self-hosted + - macOS-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - name: Test Install Script + run: scripts/test/test-mac-install.sh + shell: bash diff --git a/.github/workflows/porter-integration.yml b/.github/workflows/porter-integration.yml index 2a207136e..df4e0f5b7 100644 --- a/.github/workflows/porter-integration.yml +++ b/.github/workflows/porter-integration.yml @@ -20,13 +20,12 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3.6.0 + uses: actions/checkout@v4.1.0 - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" - # Unable to determine registry 'ghcr.io/getporter' type. The service connection was not found or the authentication type not supported. - name: Docker Login - uses: docker/login-action@v2.2.0 + uses: docker/login-action@v3.0.0 with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.github/workflows/porter-release.yml b/.github/workflows/porter-release.yml new file mode 100644 index 000000000..e188f284b --- /dev/null +++ b/.github/workflows/porter-release.yml @@ -0,0 +1,15 @@ +name: porter/porter-release +on: + push: + tags: + - v* + - "!latest*" + - "!canary*" +jobs: + build_azure_pipelinesrelease_template: + name: build_azure_pipelinesrelease_template + uses: "./.github/workflows/build_azure_pipelinesrelease_template.yml" + with: + registry: ghcr.io/getporter + shouldPublish: true + skipTests: true diff --git a/.github/workflows/test-porter-release.yml b/.github/workflows/test-porter-release.yml new file mode 100644 index 000000000..403aa2ff2 --- /dev/null +++ b/.github/workflows/test-porter-release.yml @@ -0,0 +1,26 @@ +name: porter/test-porter-release +on: + workflow_dispatch: + inputs: + shouldPublish: + default: true + type: boolean + required: false + skipTests: + default: true + type: boolean + required: false + pull_request: + branches: + - main +env: + PORTER_PACKAGES_REMOTE: https://github.com/carolynvs/porter-packages.git + PORTER_RELEASE_REPOSITORY: github.com/carolynvs/porter +jobs: + build_azure_pipelinesrelease_template: + name: build_azure_pipelinesrelease_template + uses: "./.github/workflows/build_azure_pipelinesrelease_template.yml" + with: + registry: ghcr.io/getporter/test + shouldPublish: "${{ inputs.shouldPublish }}" + skipTests: "${{ inputs.skipTests }}" diff --git a/.github/workflows/testporterbot.porter-release.yml b/.github/workflows/testporterbot.porter-release.yml new file mode 100644 index 000000000..d4acb0e7e --- /dev/null +++ b/.github/workflows/testporterbot.porter-release.yml @@ -0,0 +1,23 @@ +name: porter/testporterbot.porter-release +on: + workflow_dispatch: + inputs: + shouldPublish: + default: true + type: boolean + required: false + skipTests: + default: true + type: boolean + required: false + pull_request: + branches: + - release/v1 +jobs: + build_azure_pipelinesrelease_template: + name: build_azure_pipelinesrelease_template + uses: "./.github/workflows/build_azure_pipelinesrelease_template.yml" + with: + registry: ghcr.io/getporter/test + shouldPublish: "${{ inputs.shouldPublish }}" + skipTests: "${{ inputs.skipTests }}"