forked from gabrie30/ghorg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_integration_tests.sh
More file actions
executable file
·67 lines (51 loc) · 2.05 KB
/
github_integration_tests.sh
File metadata and controls
executable file
·67 lines (51 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -euo pipefail
echo "Running GitHub Integration Tests"
cp ./ghorg /usr/local/bin
GITHUB_ORG=underdeveloped
ghorg version
# clone an org with no config file
ghorg clone $GITHUB_ORG --token=$GITHUB_TOKEN
if [ -e $HOME/ghorg/$GITHUB_ORG ]
then
echo "Pass: github org clone using no configuration file"
else
echo "Fail: github org clone using no configuration file"
exit 1
fi
# clone an org with no config file to a specific path
ghorg clone $GITHUB_ORG --token=$GITHUB_TOKEN --path=/tmp --output-dir=testing_output_dir
if [ -e /tmp/testing_output_dir ]
then
echo "Pass: github org clone, commandline flags take overwrite conf.yaml"
else
echo "Fail: github org clone, commandline flags take overwrite conf.yaml"
exit 1
fi
# clone an org with configuration file set by config flag
ghorg clone $GITHUB_ORG --token=$GITHUB_TOKEN --config=$PWD/scripts/testing_confs/alternative_clone_path_conf.yaml
if [ -e /tmp/path_from_configuration_file ]
then
echo "Pass: github org clone, alternative configuration file path"
else
echo "Fail: github org clone, alternative configuration file path"
exit 1
fi
mkdir -p $HOME/.config/ghorg
cp sample-conf.yaml $HOME/.config/ghorg/conf.yaml
# hack to allow sed to be ran on both mac and ubuntu
sed "s/GHORG_OUTPUT_DIR:/GHORG_OUTPUT_DIR: testing_conf_is_set/g" $HOME/.config/ghorg/conf.yaml >updated_conf.yaml && \
mv $HOME/.config/ghorg/conf.yaml $HOME/.config/ghorg/conf-bak.yaml && \
mv updated_conf.yaml $HOME/.config/ghorg/conf.yaml
# clone an org with configuration set at the default location using latest sample-config.yaml
ghorg clone $GITHUB_ORG --token=$GITHUB_TOKEN
if [ -e $HOME/ghorg/testing_conf_is_set ]
then
echo "Pass: github org clone, using config file in default location"
else
echo "Fail: github org clone, using config file in default location"
exit 1
fi
# Move back to original conf but keep updated_conf if we want to use it again
mv $HOME/.config/ghorg/conf.yaml $HOME/.config/ghorg/updated_conf.yaml
mv $HOME/.config/ghorg/conf-bak.yaml $HOME/.config/ghorg/conf.yaml