Skip to content

Commit 4d2a6e5

Browse files
schristoffludfjigtroy0820
authored
Convert porter/porter to GitHub Actions (#2879)
* Add workflow porter/porter * update go install, runners have cache on by default --------- Signed-off-by: schristoff <28318173+schristoff@users.noreply.github.com> Signed-off-by: Ludvig Liljenberg <lliljenberg@microsoft.com> Co-authored-by: Ludvig Liljenberg <lliljenberg@microsoft.com> Co-authored-by: Troy Connor <troy0820@users.noreply.github.com>
1 parent 835b351 commit 4d2a6e5

File tree

3 files changed

+163
-1
lines changed

3 files changed

+163
-1
lines changed
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: porter/porter-integration
2+
# this will only run when this is on main branch apparently so use pr for now (temporary)
3+
#on:
4+
# issue_comment:
5+
# types: [created, edited]
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- 'docs/**'
12+
13+
env:
14+
GOVERSION: 1.20.7
15+
16+
jobs:
17+
Integration_test:
18+
# if: contains(github.event.comment.body, '/integration_test')
19+
name: Integration Test
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: checkout
23+
uses: actions/checkout@v3.6.0
24+
- uses: actions/setup-go@v4
25+
with:
26+
go-version: "${{ env.GOVERSION }}"
27+
# Unable to determine registry 'ghcr.io/getporter' type. The service connection was not found or the authentication type not supported.
28+
- name: Docker Login
29+
uses: docker/login-action@v2.2.0
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Native Build
35+
run: go run mage.go Build
36+
shell: bash
37+
- name: Integration Test
38+
run: go run mage.go -v TestIntegration
39+
shell: bash

.github/workflows/porter.yml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: porter/porter
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
env:
9+
GOVERSION: 1.20.7
10+
11+
jobs:
12+
Build:
13+
name: Native Compile
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: checkout
17+
uses: actions/checkout@v3.5.0
18+
- uses: actions/setup-go@v4
19+
with:
20+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
21+
- run: go version
22+
- name: Native Build
23+
run: go run mage.go build
24+
shell: bash
25+
- name: Publish Native Binaries
26+
uses: actions/upload-artifact@v3.1.1
27+
with:
28+
name: build-bin
29+
path: "${{ github.workspace }}/bin"
30+
31+
XBuild:
32+
name: Cross Compile
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: checkout
36+
uses: actions/checkout@v3.5.0
37+
- uses: actions/setup-go@v4
38+
with:
39+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
40+
- run: go version
41+
- name: Cross Compile
42+
run: go run mage.go -v XBuildAll
43+
shell: bash
44+
- name: Publish Release Binaries
45+
uses: actions/upload-artifact@v3.1.1
46+
with:
47+
name: xbuild-bin
48+
path: "${{ github.workspace }}/bin"
49+
50+
Unit_test:
51+
name: Unit Test
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: checkout
55+
uses: actions/checkout@v3.5.0
56+
- uses: actions/setup-go@v4
57+
with:
58+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
59+
- run: go version
60+
- name: Unit Test
61+
run: go run mage.go -v TestUnit
62+
shell: bash
63+
64+
VetLint:
65+
name: Vet and Lint
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: checkout
69+
uses: actions/checkout@v3.5.0
70+
- uses: actions/setup-go@v4
71+
with:
72+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
73+
- run: go version
74+
- name: Vet
75+
run: go run mage.go Vet
76+
shell: bash
77+
- name: Lint
78+
run: go run mage.go Lint
79+
shell: bash
80+
81+
Build-docker-images:
82+
name: Build Docker Images
83+
needs:
84+
- XBuild
85+
runs-on: ubuntu-latest
86+
if: success()
87+
steps:
88+
- name: checkout
89+
uses: actions/checkout@v3.5.0
90+
- uses: actions/setup-go@v4
91+
with:
92+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
93+
- run: go version
94+
- name: Download Cross-Compiled Porter Binaries
95+
uses: actions/download-artifact@v3.0.1
96+
with:
97+
name: xbuild-bin
98+
path: bin
99+
- name: Setup Bin
100+
run: go run mage.go UseXBuildBinaries
101+
- name: Build Docker Images
102+
run: go run mage.go BuildImages
103+
104+
Smoke-test:
105+
name: Smoke Test
106+
needs:
107+
- XBuild
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: checkout
111+
uses: actions/checkout@v3.5.0
112+
- name: Download Cross-Compiled Porter Binaries
113+
uses: actions/download-artifact@v3.0.1
114+
with:
115+
name: xbuild-bin
116+
path: bin
117+
- uses: actions/setup-go@v4
118+
with:
119+
go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use.
120+
- run: go version
121+
- name: Setup Bin
122+
run: go run mage.go UseXBuildBinaries
123+
- name: Run Smoke Tests
124+
run: go run mage.go -v TestSmoke

pkg/porter/lifecycle.go

-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ func (p *Porter) BuildActionArgs(ctx context.Context, installation storage.Insta
302302
AllowDockerHostAccess: opts.AllowDockerHostAccess,
303303
PersistLogs: !opts.NoLogs,
304304
}
305-
306305
return args, nil
307306
}
308307

0 commit comments

Comments
 (0)