Skip to content

Commit

Permalink
Fix shell executor (#8)
Browse files Browse the repository at this point in the history
* feat: add support for docker context, add homebrew tap, fix shell executor

* fix: improve use of test catalyst image

* fix: improve use of test catalyst image
  • Loading branch information
cplee authored Mar 4, 2024
1 parent f24c931 commit c9e226e
Show file tree
Hide file tree
Showing 42 changed files with 843 additions and 221 deletions.
53 changes: 43 additions & 10 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ on: [pull_request, workflow_dispatch]

env:
CGO_ENABLED: 0
TEST_CATALYST_IMAGE: public.ecr.aws/docker/library/node:20-bookworm-slim

jobs:
scan:
name: scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Secret Scanning
Expand All @@ -26,10 +27,10 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
check-latest: true
Expand All @@ -39,16 +40,16 @@ jobs:
- name: Run golangci-lint
run: make lint

test:
name: test
test-linux:
name: test-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
check-latest: true
Expand All @@ -59,6 +60,8 @@ jobs:

- name: Run tests
run: make test
env:
CATALYST_IMAGE: docker://${{ env.TEST_CATALYST_IMAGE }}

- name: Generate code coverage report
uses: irongut/CodeCoverageSummary@v1.3.0
Expand All @@ -80,20 +83,50 @@ jobs:
recreate: true
path: code-coverage-results.md

test-macos:
name: test-macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install and start Colima
run: |
brew install docker
colima start
docker pull ${TEST_CATALYST_IMAGE}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/setup-go@v5
with:
go-version-file: go.work
check-latest: true
cache-dependency-path: "**/go.sum"

- name: Install dev dependencies
run: make dev-deps

- name: Run tests
run: make test
env:
CATALYST_IMAGE: docker://${{ env.TEST_CATALYST_IMAGE }}

snapshot-ccr-cli:
name: snapshot-ccr-cli
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: "**/go.sum"
check-latest: true
- uses: anchore/sbom-action/download-syft@v0.14.3
- uses: anchore/sbom-action/download-syft@v0.15.8
- uses: sigstore/cosign-installer@v3
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
name: promote
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ssh-key: ${{secrets.SSH_DEPLOY_KEY}}
fetch-depth: 0
ref: main
- uses: fregante/setup-git-user@v2
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
check-latest: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
check-latest: true
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ attribution:
upgrade:
go work sync
make attribution

install:
@$(MAKE) -C codecatalyst-runner install
44 changes: 43 additions & 1 deletion codecatalyst-runner/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ builds:
- CGO_ENABLED=0
goos:
- linux
- windows
# - windows
- darwin

archives:
Expand Down Expand Up @@ -52,3 +52,45 @@ signs:
cmd: cosign
args: ["sign-blob", "--output-signature", "${artifact}.sig", "--output-certificate", "${artifact}.pem", "${artifact}"]
artifacts: all
brews:
- name: codecatalyst-runner-cli

# GitHub/GitLab repository to push the formula to
repository:
owner: aws
name: homebrew-tap

url_template: "https://github.com/aws/codecatalyst-runner-cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}"

commit_author:
name: codecatalyst-runner-cli
email: codecatalyst-runner-cli@no-reply.github.com

# The project name and current git tag are used in the format string.
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula

homepage: "https://github.com/aws/codecatalyst-runner-cli"

# Template of your app's description.
# Default is empty.
description: "CLI to run CodeCatalyst workflows locally 🧰"

# SPDX identifier of your app's license.
# Default is empty.
license: "Apache-2"

# Setting this will prevent goreleaser to actually try to commit the updated
# formula - instead, the formula file will be stored on the dist folder only,
# leaving the responsibility of publishing it to the user.
# If set to auto, the release will not be uploaded to the homebrew tap
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
# Default is false.
skip_upload: true

# So you can `brew test` your formula.
# Default is empty.
test: system "#{bin}/ccr --version"
2 changes: 1 addition & 1 deletion codecatalyst-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lint:

.PHONY: test
test:
go test -json -v -coverprofile=coverage.txt --tags=$(TAGS) -test.timeout=10m ./... 2>&1 | gotestfmt
go test -json -v -coverprofile=coverage.txt --tags=$(TAGS) -test.timeout=30m ./... 2>&1 | gotestfmt

.PHONY: test-short
test-short:
Expand Down
18 changes: 18 additions & 0 deletions codecatalyst-runner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand All @@ -35,6 +36,8 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect
github.com/aws/smithy-go v1.19.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/containerd v1.7.13 // indirect
Expand All @@ -43,12 +46,16 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/cli v25.0.2+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v25.0.2+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gdamore/tcell/v2 v2.7.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
Expand All @@ -58,6 +65,8 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
Expand All @@ -66,23 +75,31 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/moby/buildkit v0.12.5 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc6 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rivo/tview v0.0.0-20240204151237-861aa94d61c8 // indirect
github.com/rivo/uniseg v0.4.7-0.20240127222946-601bbb3750c2 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/zclconf/go-cty v1.14.2 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
Expand All @@ -95,6 +112,7 @@ require (
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit c9e226e

Please sign in to comment.