Skip to content

Commit 3b11d55

Browse files
committed
Fixing process start delays
1 parent 8ae2c6a commit 3b11d55

File tree

5 files changed

+67
-4
lines changed

5 files changed

+67
-4
lines changed

.github/workflows/build.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build and test
2+
on: [push]
3+
jobs:
4+
just_test:
5+
if: startsWith(github.ref, 'refs/heads/main')
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: actions/setup-go@v2
10+
with:
11+
go-version: '^1.13.1'
12+
- name: go test
13+
run: go test -v ./...
14+
test_build_release:
15+
if: startsWith(github.ref, 'refs/tags/')
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-go@v2
20+
with:
21+
go-version: '^1.13.1'
22+
- name: Get the version
23+
id: get_tag
24+
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
25+
- name: go test
26+
run: go test -v ./...
27+
- name: build
28+
shell: bash
29+
run: |
30+
# Make an artifacts directory
31+
mkdir -p artifacts
32+
33+
# run the build for each supported OS
34+
for os in "linux" "darwin" "windows"; do
35+
echo "Building for $os..."
36+
GOOS=$os CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_${os} .
37+
38+
# If its windows we need to rename it to have .exe at the end.
39+
if [ $os == "windows" ]; then
40+
mv ./artifacts/launch_$os ./artifacts/launch_$os.exe
41+
fi
42+
done
43+
# Make an Arm bin for linux also
44+
for arch in arm64 arm; do
45+
echo "Building for linux on $arch..."
46+
GOOS=linux GOARCH=$arch CGO_ENABLED=0 go build -a -ldflags="-X main.version=${{ steps.get_tag.outputs.SOURCE_TAG }}" -o ./artifacts/launch_linux_${arch} .
47+
done
48+
49+
- name: Release
50+
uses: softprops/action-gh-release@v1
51+
with:
52+
files: artifacts/*
53+
body_path: .github/workflows/release_body.md
54+
env:
55+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/release_body.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Bug fix and Github work flows
2+
3+
Fixed a bug where processes set to have a start delay did not delay.
4+
Adding in Github work flow.

.travis.yml

-3
This file was deleted.

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"pmlogger"
4+
]
5+
}

processmanager/process.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (p *Process) running() bool {
4141

4242
func (p *Process) processStartDelay() {
4343
if p.config.StartDelay != 0 {
44-
p.pmlogger.Debugf("Process start is configured for delayed start of %d seconds.\n", p.config.StartDelay)
44+
p.pmlogger.Printf("Process start is configured for delayed start of %d seconds.\n", p.config.StartDelay)
4545
time.Sleep(time.Second * time.Duration(p.config.StartDelay))
4646
}
4747
}
@@ -55,6 +55,8 @@ func (p *Process) runProcess(processType string) *processEnd {
5555
ExitCode: -1,
5656
}
5757

58+
p.processStartDelay()
59+
5860
if err := p.proc.Start(); err != nil {
5961
p.exitcode = 1
6062
finalState.Error = err

0 commit comments

Comments
 (0)