Conditional build based on the value of a environment variable

yanhai12345's Avatar

yanhai12345

29 Nov, 2021 11:24 PM

Without creating separate Appveyor projects, can I achieve the following using a single .yml configuration:

I have two sets of CI tests, one runs on pull request and the other scheduled to run weekly on the master branch. They share the common "init" and "install" settings but have different "test_script" and "notifications". I would like to do conditional build configurations based on "APPVEYOR_SCHEDULED_BUILD" environment variable being true or false, something like this:

build: ...
platform: ...
init: ...
install: ...
for:
- on:
    - APPVEYOR_SCHEDULED_BUILD: false
  test_script: ...
  notifications: ...
- on:
    - APPVEYOR_SCHEDULED_BUILD: true
  test_script: ...
  notifications: ...

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac