Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert porter/porter to GitHub Actions #2879

Merged
merged 14 commits into from
Jan 22, 2024
39 changes: 39 additions & 0 deletions .github/workflows/porter-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: porter/porter-integration
# this will only run when this is on main branch apparently so use pr for now (temporary)
#on:
# issue_comment:
# types: [created, edited]
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'

env:
GOVERSION: 1.20.7

jobs:
Integration_test:
# if: contains(github.event.comment.body, '/integration_test')
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.6.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
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Native Build
run: go run mage.go Build
shell: bash
- name: Integration Test
run: go run mage.go -v TestIntegration
shell: bash
124 changes: 124 additions & 0 deletions .github/workflows/porter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: porter/porter
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
env:
GOVERSION: 1.20.7

jobs:
Build:
name: Native Compile
runs-on: ubuntu-latest
steps:
- name: checkout
ludfjig marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/checkout@v3.5.0
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Native Build
run: go run mage.go build
shell: bash
- name: Publish Native Binaries
uses: actions/upload-artifact@v3.1.1
with:
name: build-bin
path: "${{ github.workspace }}/bin"

XBuild:
name: Cross Compile
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.5.0
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Cross Compile
run: go run mage.go -v XBuildAll
shell: bash
- name: Publish Release Binaries
uses: actions/upload-artifact@v3.1.1
with:
name: xbuild-bin
path: "${{ github.workspace }}/bin"

Unit_test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.5.0
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Unit Test
run: go run mage.go -v TestUnit
shell: bash

VetLint:
name: Vet and Lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.5.0
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Vet
run: go run mage.go Vet
shell: bash
- name: Lint
run: go run mage.go Lint
shell: bash

Build-docker-images:
name: Build Docker Images
needs:
- XBuild
runs-on: ubuntu-latest
if: success()
steps:
- name: checkout
uses: actions/checkout@v3.5.0
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Download Cross-Compiled Porter Binaries
uses: actions/download-artifact@v3.0.1
with:
name: xbuild-bin
path: bin
- name: Setup Bin
run: go run mage.go UseXBuildBinaries
- name: Build Docker Images
run: go run mage.go BuildImages

Smoke-test:
name: Smoke Test
needs:
- XBuild
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.5.0
- name: Download Cross-Compiled Porter Binaries
uses: actions/download-artifact@v3.0.1
with:
name: xbuild-bin
path: bin
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
- run: go version
- name: Setup Bin
run: go run mage.go UseXBuildBinaries
- name: Run Smoke Tests
run: go run mage.go -v TestSmoke
1 change: 0 additions & 1 deletion pkg/porter/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func (p *Porter) BuildActionArgs(ctx context.Context, installation storage.Insta
AllowDockerHostAccess: opts.AllowDockerHostAccess,
PersistLogs: !opts.NoLogs,
}

return args, nil
}

Expand Down
Loading