Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows, update API version, update testing suite #16

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a4549ef
Add cronitor discover functionality for Windows
jdotjdot May 20, 2022
70f741c
Separate out Windows so all builds work
jdotjdot May 20, 2022
8fcfa02
add back taskmaster
jdotjdot May 23, 2022
b264dd0
Update for latest version of monitors API
jdotjdot May 25, 2022
aee4ab9
Fix windows duplicate lines by using patched promptui
jdotjdot May 29, 2022
4c3a9ff
Add NextRunTime as schedule parameter to monitors and ping
jdotjdot May 29, 2022
bfb6328
Move tests from Windows Server to Github Actions -- initial automation
jdotjdot Jun 21, 2022
9a775e8
use bash
jdotjdot Jun 21, 2022
2a229a6
try to set up bats
jdotjdot Jun 21, 2022
f51b975
does this just work?
jdotjdot Jun 21, 2022
26a7915
no sudo on windows
jdotjdot Jun 21, 2022
abfd20e
fix activity
jdotjdot Jun 21, 2022
7de010e
try using load instead
jdotjdot Jun 21, 2022
c353bd9
try to fix directory name?
jdotjdot Jun 21, 2022
0b19c7b
change bash on windows
jdotjdot Jun 21, 2022
68bcfaa
move more into setup() for discover
jdotjdot Jun 21, 2022
fb87e35
windwos path again
jdotjdot Jun 21, 2022
4b69d44
move tmpdir to BATS one
jdotjdot Jun 21, 2022
5874338
try to avoid loading setup entirely
jdotjdot Jun 21, 2022
3e20ffc
try to fix load for discover
jdotjdot Jun 21, 2022
caa523d
add setup_suite.bash
jdotjdot Jun 21, 2022
5ea4c16
is setup_suite() running?
jdotjdot Jun 21, 2022
f8fa6f5
add shebang
jdotjdot Jun 21, 2022
fdae75d
cant print file descirptor
jdotjdot Jun 21, 2022
29f3bbf
export everything
jdotjdot Jun 21, 2022
567c5d7
update setup_suite shebang
jdotjdot Jun 21, 2022
fffc73d
update all /tmp/ or /etc/ to $BATS_TMPDIR
jdotjdot Jun 21, 2022
34cda50
put back /etc/cronitor
jdotjdot Jun 21, 2022
18e7777
deal with /etc/
jdotjdot Jun 21, 2022
eb2e103
use C: instead of systemdrive
jdotjdot Jun 21, 2022
25726b6
clean up $CLI_CRONTAB_TEMP
jdotjdot Jun 21, 2022
8608e09
fix some tests
jdotjdot Jun 21, 2022
4667757
split out common code
jdotjdot Jun 21, 2022
bb5bf70
fix load again
jdotjdot Jun 21, 2022
6f9a0e1
more test fixes
jdotjdot Jun 21, 2022
c7e69e2
fix $PROJECT_DIR?
jdotjdot Jun 21, 2022
14b0f7d
try to fix exec again
jdotjdot Jun 21, 2022
f50d768
remove schedule from Windows monitor creation
jdotjdot Jun 22, 2022
ed304a5
try to fix script path
jdotjdot Jun 22, 2022
b788a88
does using specific filename work?
jdotjdot Jun 22, 2022
f259da0
run a test with BATS_TEST_TMPDIR
jdotjdot Jun 22, 2022
f2869b5
old $CLI_CRONTAB_TEMP
jdotjdot Jun 22, 2022
04f3dec
is this better
jdotjdot Jun 22, 2022
ac971f4
is this better?
jdotjdot Jun 22, 2022
2616279
try to see whats goign on
jdotjdot Jun 22, 2022
184dde3
more test updates
jdotjdot Jun 23, 2022
3657011
more test changes
jdotjdot Jun 23, 2022
7996509
last linux test
jdotjdot Jun 23, 2022
3173fc3
Pin API version
jdotjdot Jun 26, 2022
cd6e202
unremove tests stopped for `key`
jdotjdot Jun 26, 2022
d021fca
fix fixtures reference
jdotjdot Jun 26, 2022
926e21d
test output
jdotjdot Jun 27, 2022
eb53663
reorder crontab
jdotjdot Jun 27, 2022
73631cf
split exec test windows/linux
jdotjdot Jun 27, 2022
693f572
add bats minimum version
jdotjdot Jun 27, 2022
1e203ab
try without using BATS_TMPDIR on windows for logfile
jdotjdot Jun 27, 2022
2c4e012
try to specify CLI_CRONTAB_TEMP
jdotjdot Jun 27, 2022
fd2af7d
Revert "try without using BATS_TMPDIR on windows for logfile"
jdotjdot Jun 27, 2022
d456804
what is wrong here
jdotjdot Jun 28, 2022
5b5f954
whoops
jdotjdot Jun 28, 2022
78e69c0
more tests
jdotjdot Jun 28, 2022
5d0be16
whats going on
jdotjdot Jun 28, 2022
35ee6a3
try with windows syntax
jdotjdot Jun 28, 2022
7854f05
exit codes
jdotjdot Jun 28, 2022
958d89e
lets try again
jdotjdot Jun 28, 2022
fe839a5
silence that annoying failing test
jdotjdot Jul 10, 2022
283b599
test powershell directly
jdotjdot Jul 10, 2022
a0b3f2a
fix test_helper load
jdotjdot Jul 10, 2022
41ba092
test new exec code stuff
jdotjdot Jul 10, 2022
bf8f5e2
try again
jdotjdot Jul 10, 2022
fde7401
try writing to &3
jdotjdot Jul 10, 2022
5d3c894
remove extra exit printing code
jdotjdot Jul 10, 2022
32d12c5
silence windows exit code test
jdotjdot Jul 15, 2022
4206e5c
Version 31.0, adding support for Windows Scheduled Tasks
shaneharter Sep 2, 2022
7cf8904
Update Discover UI - Replace PromptUI with BubbleTea
shaneharter Dec 19, 2024
700f57d
Add signup and update commands
shaneharter Dec 22, 2024
89791a6
Improve signal and stdin handling
shaneharter Dec 22, 2024
edfb4b9
Show clear instructions when running discover without being authentic…
shaneharter Dec 22, 2024
8f8048e
Bump to Go 1.23
shaneharter Dec 22, 2024
f36830e
Fix bugs with new API adaptation, clean up some UX language on Discover
shaneharter Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,48 @@ on:
- push

jobs:
tests:
name: Run tests
windows-tests:
name: Run Windows tests
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2

- uses: actions/setup-go@v3

# Prefer MSYS2 bash to git bash
- name: "add-path"
shell: cmd
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
echo ::add-path::C:\msys64\usr\bin
dir C:\msys64\usr\bin

- name: Setup BATS
uses: mig4/setup-bats@v1
with:
bats-version: 1.7.0

- name: Build binary
shell: bash
run: go build -o cronitor main.go

- name: Run tests
working-directory: tests
shell: bash
env:
CRONITOR_API_KEY: "${{ secrets.CRONITOR_API_KEY }}"
WINDOWS: 'true'
run: |
echo "::add-mask::cb54ac4fd16142469f2d84fc1bbebd84"
echo "::add-mask::$CRONITOR_API_KEY"
export BATS_PATH="$(which bats)"
$BATS_PATH *.bats


linux-tests:
name: Run Linux tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -25,6 +65,7 @@ jobs:
working-directory: tests
env:
CRONITOR_API_KEY: "${{ secrets.CRONITOR_API_KEY }}"
WINDOWS: 'false'
run: |
echo "::add-mask::cb54ac4fd16142469f2d84fc1bbebd84"
echo "::add-mask::$CRONITOR_API_KEY"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ cronitor
*.key
ctab
cronitor-cli
cronitor.exe

local.md
TODO.md
*.exe
*.exe
8 changes: 8 additions & 0 deletions bin/fail.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

function ExitWithCode($exitcode) {
Write-Host "exiting with code 123"
$host.SetShouldExit($exitcode)
exit $exitcode
}

ExitWithCode 123
7 changes: 4 additions & 3 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cmd
import (
"encoding/json"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"io/ioutil"
"os"

"github.com/spf13/cobra"
"github.com/spf13/viper"
)

type ConfigFile struct {
Expand Down Expand Up @@ -113,7 +114,7 @@ Example setting common exclude text for use with 'cronitor discover':
if ioutil.WriteFile(configFilePath(), b, 0644) != nil {
fmt.Fprintf(os.Stderr,
"\nERROR: The configuration file %s could not be written; check permissions and try again. "+
"\n By default, configuration files are system-wide for ease of use in cron jobs and scripts. Specify an alternate config file using the --config argument or CRONITOR_CONFIG environment variable.\n\n", configFilePath())
"\n By default, configuration files are system-wide for ease of use in cron jobs and scripts. Specify an alternate config file using the --config argument or CRONITOR_CONFIG environment variable.\n\n", configFilePath())
os.Exit(126)
}
},
Expand Down
Loading
Loading