Skip to content

Commit

Permalink
Merge branch 'develop' into doco-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdmharvey authored Apr 24, 2023
2 parents 7613496 + a588835 commit 548482d
Show file tree
Hide file tree
Showing 104 changed files with 5,060 additions and 2,137 deletions.
36 changes: 23 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ version: 2.1

orbs:
shellcheck: circleci/[email protected]
windows: circleci/windows@2.2.0
windows: circleci/windows@5.0.0

executors:
go:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.20
environment:
CGO_ENABLED: 0
mac:
Expand Down Expand Up @@ -82,17 +82,22 @@ commands:

jobs:
test_windows:
executor: windows/default
executor:
name: windows/default
shell: bash --login -eo pipefail
steps:
- run: git config --global core.autocrlf false
- checkout
- run: setx GOPATH %USERPROFILE%\go
- run: go get gotest.tools/gotestsum
- run: mkdir test_results

- run:
name: Run tests
command: |
C:\Users\circleci\go\bin\gotestsum.exe --junitfile test_results/windows.xml
export GOBIN=/c/go/bin
export PATH=$GOBIN:$PATH
export TESTING="true"
go install gotest.tools/gotestsum@latest
gotestsum --junitfile test_results/windows.xml
- store_test_results:
path: test_results
- store_artifacts:
Expand All @@ -103,8 +108,8 @@ jobs:
- checkout
- run: |
brew update
brew install go@1.18
echo 'export PATH="/usr/local/opt/go@1.18/bin:$PATH"' >> ~/.bash_profile
brew install go@1.20
echo 'export PATH="/usr/local/opt/go@1.20/bin:$PATH"' >> ~/.bash_profile
- gomod
- run: make test
build:
Expand Down Expand Up @@ -133,7 +138,8 @@ jobs:
- run:
command: bundle exec cucumber
working_directory: integration_tests

environment:
TESTING: "true"
test:
executor: go
steps:
Expand Down Expand Up @@ -264,9 +270,9 @@ jobs:
brew-deploy:
executor: mac
environment:
- USER: circleci
- TRAVIS: circleci
- DESTDIR: /Users/distiller/dest
USER: circleci
TRAVIS: circleci
DESTDIR: /Users/distiller/dest
steps:
- checkout
- force-http-1
Expand Down Expand Up @@ -329,6 +335,8 @@ workflows:
- brew-deploy:
requires:
- run-brew-deploy-gate
context:
- devex-release
- deploy:
requires:
- test
Expand All @@ -339,4 +347,6 @@ workflows:
- shellcheck/check
filters:
branches:
only: master
only: main
context:
- devex-release
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
5 changes: 2 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
* @CircleCI-Public/Extensibility
*orb*.go @CircleCI-Public/CPEng @CircleCI-Public/Extensibility
* @CircleCI-Public/developer-experience
*orb*.go @CircleCI-Public/orb-publishers @CircleCI-Public/developer-experience

/api/runner @CircleCI-Public/runner
/cmd/runner @CircleCI-Public/runner

8 changes: 6 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have checked for similar issues and haven't found anything relevant.
- [ ] This is not a security issue (which should be reported here: https://circleci.com/security/)
- [ ] I have read [Contribution Guidelines](https://github.com/CircleCI-Public/circleci-cli/blob/master/CONTRIBUTING.md).
- [ ] I have read [Contribution Guidelines](https://github.com/CircleCI-Public/circleci-cli/blob/main/CONTRIBUTING.md).

### Internal Checklist
- [ ] I am requesting a review from my own team as well as the owning team
- [ ] I have a plan in place for the monitoring of the changes that I am making (this can include new monitors, logs to be aware of, etc...)

## Changes

Expand Down Expand Up @@ -41,7 +45,7 @@ Image or gif where change can be clearly seen

## **Here are some helpful tips you can follow when submitting a pull request:**

1. Fork [the repository](https://github.com/CircleCI-Public/circleci-cli) and create your branch from `master`.
1. Fork [the repository](https://github.com/CircleCI-Public/circleci-cli) and create your branch from `main`.
2. Run `make build` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`make test`).
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cimg/go:1.18.3
FROM cimg/go:1.20

ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ clean:

.PHONY: test
test:
go test -v ./...
TESTING=true go test -v ./...

.PHONY: cover
cover:
go test -race -coverprofile=coverage.txt ./...
TESTING=true go test -race -coverprofile=coverage.txt ./...

.PHONY: lint
lint:
Expand Down
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,45 @@ choco install circleci-cli -y
You can also install the CLI binary by running our install script on most Unix platforms:

```
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | bash
```

By default, the `circleci` app will be installed to the ``/usr/local/bin`` directory. If you do not have write permissions to `/usr/local/bin`, you may need to run the above command with `sudo`:

```
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash
```

Alternatively, you can install to an alternate location by defining the `DESTDIR` environment variable when invoking `bash`:

```
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | DESTDIR=/opt/bin bash
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | DESTDIR=/opt/bin bash
```

You can also set a specific version of the CLI to install with the `VERSION` environment variable:

```
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | VERSION=0.1.5222 sudo bash
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo VERSION=0.1.5222 bash
```

Take note that additional environment variables should be passed between sudo and invoking bash.

#### Checksum verification

If you would like to verify the checksum yourself, you can download the checksum file from the [GitHub releases page](https://github.com/CircleCI-Public/circleci-cli/releases) and verify the checksum of the archive using the `circleci-cli_<version>_checksums.txt` inside the assets of the release you'd like to install:

On macOS and Linux:
```sh
shasum -a 256 circleci-cli_<version>_<os>.tar.gz
```

and on Windows:
```powershell
Get-FileHash .\circleci-cli_<version>_<os>.tar.gz -Algorithm SHA256 | Format-List
```

And compare it to the right checksum depending on the downloaded version in the `circleci-cli_<version>_checksums.txt` file.

### Updating

If you installed the CLI without a package manager, you can use its built-in update command to check for pending updates and download them:
Expand Down Expand Up @@ -134,17 +152,17 @@ The following commands are affected:

## Platforms, Deployment and Package Managers

The tool is deployed through a number of channels. The primary release channel is through [GitHub Releases](https://github.com/CircleCI-Public/circleci-cli/releases). Green builds on the `master` branch will publish a new GitHub release. These releases contain binaries for macOS, Linux and Windows. These releases are published from [CircleCI](https://app.circleci.com/pipelines/github/CircleCI-Public/circleci-cli) using [GoReleaser](https://goreleaser.com/).
The tool is deployed through a number of channels. The primary release channel is through [GitHub Releases](https://github.com/CircleCI-Public/circleci-cli/releases). Green builds on the `main` branch will publish a new GitHub release. These releases contain binaries for macOS, Linux and Windows. These releases are published from (CircleCI)[https://app.circleci.com/pipelines/github/CircleCI-Public/circleci-cli] using [GoReleaser](https://goreleaser.com/).

### Homebrew

We publish the tool to [Homebrew](https://brew.sh/). The tool is [part of `homebrew-core`](https://github.com/Homebrew/homebrew-core/blob/master/Formula/circleci.rb), and therefore the maintainers of the tool are obligated to follow the guidelines for acceptable Homebrew formulae. You should [familiarise yourself with the guidelines](https://docs.brew.sh/Acceptable-Formulae#we-dont-like-tools-that-upgrade-themselves) before making changes to the Homebrew deployment system.
We publish the tool to [Homebrew](https://brew.sh/). The tool is [part of `homebrew-core`](https://github.com/Homebrew/homebrew-core/blob/main/Formula/circleci.rb), and therefore the maintainers of the tool are obligated to follow the guidelines for acceptable Homebrew formulae. You should [familairise yourself with the guidelines](https://docs.brew.sh/Acceptable-Formulae#we-dont-like-tools-that-upgrade-themselves) before making changes to the Homebrew deployment system.

The particular considerations that we make are:


1. Since Homebrew [doesn't "like tools that upgrade themselves"](https://docs.brew.sh/Acceptable-Formulae#we-dont-like-tools-that-upgrade-themselves), we disable the `circleci update` command when the tool is released through homebrew. We do this by [defining the PackageManager](https://github.com/Homebrew/homebrew-core/blob/eb1fdb84e2924289bcc8c85ee45081bf83dc024d/Formula/circleci.rb#L28) constant to `homebrew`, which allows us to [disable the `update` command at runtime](https://github.com/CircleCI-Public/circleci-cli/blob/67c7d52bace63846f87a1ed79f67f257c94a55b4/cmd/root.go#L119-L123).
1. We want to avoid every push to `master` from creating a Pull Request to the `circleci` formula on Homebrew. We want to avoid overloading the Homebrew team with pull requests to update our formula for small changes (changes to docs or other files that don't change functionality in the tool).
1. We want to avoid every push to `main` from creating a Pull Request to the `circleci` formula on Homebrew. We want to avoid overloading the Homebrew team with pull requests to update our formula for small changes (changes to docs or other files that don't change functionality in the tool).

### Snap

Expand All @@ -159,3 +177,4 @@ Development instructions for the CircleCI CLI can be found in [HACKING.md](HACKI
## More

Please see the [documentation](https://circleci-public.github.io/circleci-cli) or `circleci help` for more.

60 changes: 60 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: '3'

tasks:
lint:
desc: Lint code
cmds:
- golangci-lint run -c .golangci.yml
summary: Lint the project with golangci-lint

clean:
desc: Cleans out the build, out, docs, and dist directories
cmds:
- GO111MODULE=off go clean -i
- rm -rf build out docs dist

fmt:
desc: Run `go fmt` to format the code
cmds:
- go fmt ./...

test:
desc: Run the tests
cmds:
- TESTING=true go test -v ./...

tidy:
desc: Run 'go mod tidy' to clean up module files.
cmds:
- go mod tidy -v

doc:
desc: run's the godocs
cmds:
- godoc -http=:6060

check-go-mod:
desc: Check go.mod is tidy
cmds:
- go mod tidy -v
- git diff --exit-code -- go.mod go.sum

vendor:
desc: go mod vendor
cmds:
- go mod vendor

build:
desc: Build main
cmds:
- go build -v -o build/darwin/amd64/circleci .

build-linux:
desc: Build main
cmds:
- go build -v -o build/linux/amd64/circleci .

cover:
desc: tests and generates a cover profile
cmds:
- TESTING=true go test -race -coverprofile=coverage.txt ./...
Loading

0 comments on commit 548482d

Please sign in to comment.