Skip to content

Commit

Permalink
Support AWS CodeBuild, BitBucket, and Azure DevOps Pipelines + custom…
Browse files Browse the repository at this point in the history
… CI providers
  • Loading branch information
siddhantdange committed Jun 8, 2023
1 parent 63aecd5 commit 721abb0
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 261 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ jobs:
chmod +x ./buildpulse-test-reporter
./buildpulse-test-reporter submit tmp/test-results --account-id 68192324 --repository-id 280914963
golangci-lint:
name: Lint

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50

govulncheck:
name: Vulnerability check

Expand Down Expand Up @@ -123,7 +110,7 @@ jobs:
# If the push that triggered this is a tag that starts with "v" (e.g., v1.0.0)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}

needs: [build, golangci-lint, smoke-test]
needs: [build, smoke-test]

runs-on: macos-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Upload test results to BuildPulse for flaky test detection
if: "!cancelled()" # Run this step even when the tests fail. Skip if the workflow is cancelled.
uses: Workshop64/buildpulse-action@main
uses: buildpulse/buildpulse-action@main
with:
account: ${{ env.BUILDPULSE_ACCOUNT_ID }}
repository: ${{ env.BUILDPULSE_REPOSITORY_ID }}
Expand Down
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,67 @@ The BuildPulse test reporter is a binary that connects your continuous integrati

Get started at [buildpulse.io][].

Setup:
## Setup

Install goreleaser to build
```
brew install goreleaser/tap/goreleaser upx
```

To Build:
`./script/build-snapshot`
## Build
The following will build the binary.
```
./script/build-snapshot
```

The binary can be found in `./dist`. The following platforms + architectures are supported:

- Darwin / Mac OS (amd64, arm64)
- Windows (amd64)
- Linux (amd64, arm64)
- Ubuntu
- Debian
- Fedora
- CentOS
- RedHat
- Alpine

## Natively Supported CI Providers
We are able to infer the required environment variables from the following CI providers:

- Github Actions
- BuildKit
- CircleCI
- Github Actions
- Jenkins
- Semaphore
- Travis CI
- Webapp.io
- AWS CodeBuild
- BitBucket Pipelines
- Azure DevOps Pipelines

## Other CI Providers / Standalone Usage
To use `test-reporter` with another CI provider, the following environment variables must be set:

| Environment Variable | Description |
|----------------------|--------------------------------------------------------------------|
| `GIT_COMMIT` | Git commit SHA |
| `GIT_BRANCH` | Git branch of the build, or PR number |
| `BUILD_URL` | URL of the build. If running locally, set as `https://example.com` |
| `ORGANIZATION_NAME` | Name of the Github organization |
| `REPOSITORY_NAME` | Name of the repository |

Example:
```
BUILDPULSE_ACCESS_KEY_ID=$INPUT_KEY \
BUILDPULSE_SECRET_ACCESS_KEY=$INPUT_SECRET \
GIT_COMMIT=$GIT_COMMIT \
GIT_BRANCH=$GIT_BRANCH \
BUILD_URL=$BUILD_URL \
ORGANIZATION_NAME=$ORGANIZATION_NAME \
REPOSITORY_NAME=$REPOSITORY_NAME \
./buildpulse-test-reporter submit $REPORT_PATH --account-id $ACCOUNT_ID --repository-id $REPOSITORY_ID --repository-dir $REPOSITORY_PATH
```

[buildpulse.io]: https://buildpulse.io?utm_source=github.com&utm_campaign=tool-repositories&utm_content=test-reporter-text-link
3 changes: 0 additions & 3 deletions cmd/test-reporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FLAGS
--repository-id (required) BuildPulse repository ID for the repository that produced the test results
--repository-dir Path to local git clone of the repository (default: ".")
--tree SHA-1 hash of the git tree that produced the test results (for use only if a local git clone does not exist)
--endpoint-url Hostname to point AWS client for uploading build archive
ENVIRONMENT VARIABLES
Set the following environment variables:
Expand All @@ -38,8 +37,6 @@ ENVIRONMENT VARIABLES
BUILDPULSE_SECRET_ACCESS_KEY BuildPulse secret access key for the account that owns the repository
BUILDPULSE_BUCKET AWS S3 bucket for storing build archive (default: 'buildpulse-uploads')
EXAMPLE
$ %s submit test/reports/*.xml --account-id 42 --repository-id 8675309
`, "\t", " ")
Expand Down
36 changes: 19 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,47 @@ module github.com/buildpulse/test-reporter
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.150
github.com/caarlos0/env/v6 v6.3.1-0.20200712182401-52290f9d615e
github.com/aws/aws-sdk-go v1.44.211
github.com/caarlos0/env/v6 v6.10.1
github.com/dnaeon/go-vcr v1.2.0
github.com/go-git/go-git/v5 v5.4.2
github.com/go-git/go-git/v5 v5.6.0
github.com/google/uuid v1.3.0
github.com/mholt/archiver/v3 v3.5.1-0.20210112195346-074da64920d3
github.com/mholt/archiver/v3 v3.5.1
github.com/otiai10/copy v1.9.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.2
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-billy/v5 v5.4.0 // indirect
github.com/golang/snappy v0.0.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.11.4 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/pierrec/lz4/v4 v4.1.2 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.1.0 // indirect
github.com/ulikunitz/xz v0.5.9 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
Loading

0 comments on commit 721abb0

Please sign in to comment.