github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/features/imports.feature (about) 1 Feature: Running tasks 2 3 Background: 4 Given I'm in project dir 5 6 Scenario: Import tasks from installed packs 7 Given file ./Oyafile containing 8 """ 9 Project: project 10 11 Require: 12 github.com/test/foo: v0.0.1 13 14 Import: 15 foo: github.com/test/foo 16 """ 17 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 18 """ 19 all: | 20 touch OK 21 echo "Done" 22 """ 23 When I run "oya run foo.all" 24 Then the command succeeds 25 And the command outputs 26 """ 27 Done 28 29 """ 30 And file ./OK exists 31 32 Scenario: Import task using pack values 33 Given file ./Oyafile containing 34 """ 35 Project: project 36 37 Require: 38 github.com/test/foo: v0.0.1 39 40 Import: 41 foo: github.com/test/foo 42 """ 43 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 44 """ 45 Values: 46 foo: xxx 47 all: | 48 bar="${Oya[foo]}" 49 echo $bar 50 """ 51 When I run "oya run foo.all" 52 Then the command succeeds 53 And the command outputs 54 """ 55 xxx 56 57 """ 58 59 Scenario: Import task using BasePath 60 Given file ./Oyafile containing 61 """ 62 Project: project 63 64 Require: 65 github.com/test/foo: v0.0.1 66 67 Import: 68 foo: github.com/test/foo 69 """ 70 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 71 """ 72 Values: 73 foo: xxx 74 all: | 75 bar=$(basename ${Oya[BasePath]}) 76 echo $bar 77 """ 78 When I run "oya run foo.all" 79 Then the command succeeds 80 And the command outputs 81 """ 82 foo@v0.0.1 83 84 """ 85 86 Scenario: Access pack values 87 Given file ./Oyafile containing 88 """ 89 Project: project 90 91 Require: 92 github.com/test/foo: v0.0.1 93 94 Import: 95 foo: github.com/test/foo 96 all: | 97 echo ${Oya[foo.bar]} 98 """ 99 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 100 """ 101 Values: 102 bar: xxx 103 """ 104 When I run "oya run all" 105 Then the command succeeds 106 And the command outputs 107 """ 108 xxx 109 110 """ 111 112 Scenario: Access current project values 113 Given file ./Oyafile containing 114 """ 115 Project: main 116 Values: 117 foo: main 118 """ 119 And file ./project1/Oyafile containing 120 """ 121 Values: 122 foo: project1 123 """ 124 And file ./project2/Oyafile containing 125 """ 126 Import: 127 main: / 128 p1: /project1 129 Values: 130 foo: project2 131 all: | 132 echo ${Oya[main.foo]} 133 echo ${Oya[p1.foo]} 134 echo ${Oya[foo]} 135 """ 136 When I run "oya run --recurse all" 137 Then the command succeeds 138 And the command outputs 139 """ 140 main 141 project1 142 project2 143 144 """ 145 146 Scenario: Pack values can be set from project Oyafile prefixed with pack alias 147 Given file ./Oyafile containing 148 """ 149 Project: project 150 151 Require: 152 github.com/test/foo: v0.0.1 153 154 Import: 155 foo: github.com/test/foo 156 157 Values: 158 foo: 159 fruit: banana 160 """ 161 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 162 """ 163 all: | 164 echo ${Oya[fruit]} 165 """ 166 When I run "oya run foo.all" 167 Then the command succeeds 168 And the command outputs 169 """ 170 banana 171 172 """ 173 174 Scenario: Pack values are overriden in main Oyafile 175 Given file ./Oyafile containing 176 """ 177 Project: project 178 179 Require: 180 github.com/test/foo: v0.0.1 181 182 Import: 183 foo: github.com/test/foo 184 185 Values: 186 foo: 187 wege: broccoli 188 """ 189 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 190 """ 191 Values: 192 fruit: banana 193 wege: carrot 194 195 all: | 196 echo ${Oya[fruit]} 197 echo ${Oya[wege]} 198 """ 199 When I run "oya run foo.all" 200 Then the command succeeds 201 And the command outputs 202 """ 203 banana 204 broccoli 205 206 """ 207 208 # Regression test for #24 209 Scenario: Import tasks in a subdir Oyafile 210 Given file ./Oyafile containing 211 """ 212 Project: project 213 214 Require: 215 github.com/test/foo: v0.0.1 216 217 """ 218 And file ./subdir/Oyafile containing 219 """ 220 Import: 221 foo: github.com/test/foo 222 """ 223 And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing 224 """ 225 all: | 226 echo "all" 227 """ 228 And I'm in the ./subdir dir 229 When I run "oya run --recurse foo.all" 230 Then the command succeeds 231 And the command outputs 232 """ 233 all 234 235 """ 236 237 Scenario: Import tasks from a subdirectory 238 Given file ./Oyafile containing 239 """ 240 Project: main 241 """ 242 And file ./project1/Oyafile containing 243 """ 244 Values: 245 foo: project1 246 247 echo: | 248 echo "project1" 249 """ 250 And file ./project2/Oyafile containing 251 """ 252 Import: 253 project1: /project1 254 """ 255 And I'm in the ./project2 dir 256 When I run "oya run project1.echo" 257 Then the command succeeds 258 And the command outputs 259 """ 260 project1 261 262 """