Compare commits
3 Commits
release/v1
...
matthewpi/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3546a2c461 | ||
|
|
68d4fb454f | ||
|
|
136540111d |
15
.github/workflows/build-test.yml
vendored
15
.github/workflows/build-test.yml
vendored
@@ -32,17 +32,20 @@ jobs:
|
||||
go env
|
||||
printf "\n\nSystem Environment:\n\n"
|
||||
env
|
||||
|
||||
printf "Git Version: $(git version)\n\n"
|
||||
echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}"
|
||||
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
||||
echo "::set-output name=go_cache::$(go env GOCACHE)"
|
||||
echo "::set-output name=go_mod_cache::$(go env GOMODCACHE)"
|
||||
- name: Build Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.env.outputs.go_cache }}
|
||||
key: ${{ runner.os }}-${{ matrix.go }}-go-${{ hashFiles('**/go.sum') }}
|
||||
key: ${{ runner.os }}-go${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.go }}-go
|
||||
${{ runner.os }}-go${{ matrix.go }}-
|
||||
path: |
|
||||
${{ steps.env.outputs.go_cache }}
|
||||
${{ steps.env.outputs.go_mod_cache }}
|
||||
- name: Get Dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
@@ -56,8 +59,10 @@ jobs:
|
||||
go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go
|
||||
upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
- name: Test
|
||||
- name: Tests
|
||||
run: go test ./...
|
||||
- name: Tests (Race)
|
||||
run: go test -race ./...
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
@@ -49,10 +49,12 @@ func (e *Environment) Attach(ctx context.Context) error {
|
||||
if e.IsAttached() {
|
||||
return nil
|
||||
}
|
||||
e.log().Debug("not attached to container, continuing with attach...")
|
||||
|
||||
if err := e.followOutput(); err != nil {
|
||||
return err
|
||||
}
|
||||
e.log().Debug("following container output")
|
||||
|
||||
opts := types.ContainerAttachOptions{
|
||||
Stdin: true,
|
||||
@@ -62,11 +64,13 @@ func (e *Environment) Attach(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Set the stream again with the container.
|
||||
e.log().Debug("attempting to attach...")
|
||||
if st, err := e.client.ContainerAttach(ctx, e.Id, opts); err != nil {
|
||||
return err
|
||||
} else {
|
||||
e.SetStream(&st)
|
||||
}
|
||||
e.log().Debug("attached!")
|
||||
|
||||
go func() {
|
||||
// Don't use the context provided to the function, that'll cause the polling to
|
||||
|
||||
@@ -111,14 +111,19 @@ func (e *Environment) Start(ctx context.Context) error {
|
||||
actx, cancel := context.WithTimeout(ctx, time.Second*30)
|
||||
defer cancel()
|
||||
|
||||
if err := e.Attach(actx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
e.log().Debug("attempting to start container...")
|
||||
if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil {
|
||||
return errors.WrapIf(err, "environment/docker: failed to start container")
|
||||
}
|
||||
e.log().Debug("started container!")
|
||||
|
||||
// No errors, good to continue through.
|
||||
sawError = false
|
||||
|
||||
return e.Attach(actx)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop stops the container that the server is running in. This will allow up to
|
||||
|
||||
Reference in New Issue
Block a user