Skip to content

Commit

Permalink
feat: support codemagic CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gkampitakis committed Sep 9, 2022
1 parent c361bfa commit ea7ad60
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.19.x
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.16.x", "1.17.x", "1.18.x"]
go: ["1.16.x", "1.17.x", "1.18.x", "1.19.x"]
steps:
- uses: actions/checkout@v3
- name: Setup go
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: install-tools lint test test-verbose format benchmark
.PHONY: install-tools lint test test-verbose format

install-tools:
# Install linting tools
Expand All @@ -18,6 +18,3 @@ test:

test-verbose:
go test -race -test.timeout 120s -v -cover -count=1 ./...

benchmark:
go test -bench=. -benchmem ./...
27 changes: 25 additions & 2 deletions ciinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestCI(t *testing.T) {

initialize()

assertEqual(t, 39, len(vendors), "We should have 39 vendors")
assertEqual(t, 40, len(vendors), "We should have 40 vendors")
assertEqual(t, true, IsCI)
assertEqual(t, isActualPr(), IsPr)
assertEqual(t, "GitHub Actions", Name)
Expand Down Expand Up @@ -263,6 +263,29 @@ func TestCI(t *testing.T) {
setEnv(t, "CIRRUS_CI", "true")
},
},
{
description: "Codemagic - PR",
expected: ScenarioExpected{
isPR: true,
name: "Codemagic",
constant: "CODEMAGIC",
},
setup: func(t *testing.T) {
setEnv(t, "CM_BUILD_ID", "true")
setEnv(t, "CM_PULL_REQUEST", "42")
},
},
{
description: "Codemagic - Not PR",
expected: ScenarioExpected{
isPR: false,
name: "Codemagic",
constant: "CODEMAGIC",
},
setup: func(t *testing.T) {
setEnv(t, "CM_BUILD_ID", "true")
},
},
{
description: "Codefresh - PR",
expected: ScenarioExpected{
Expand Down Expand Up @@ -650,7 +673,7 @@ func TestCI(t *testing.T) {
},
},
{
description: "Xcode Cloud",
description: "Xcode Cloud - Not PR",
expected: ScenarioExpected{
isPR: false,
name: "Xcode Cloud",
Expand Down
6 changes: 6 additions & 0 deletions vendors.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ var vendors = []vendor{
},
},
},
{
name: "Codemagic",
constant: "CODEMAGIC",
env: []env{{key: "CM_BUILD_ID"}},
pr: []pr{{key: "CM_PULL_REQUEST"}},
},
{
name: "AWS CodeBuild",
constant: "CODEBUILD",
Expand Down

0 comments on commit ea7ad60

Please sign in to comment.