forked from MikeMcC399/github-action
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (78 loc) · 2.4 KB
/
example-env.yml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: example-env
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:
env:
# pass an environment variable to Cypress
# a test can get its value like this
# Cypress.env('environmentName') // 'staging'
# see https://on.cypress.io/env
CYPRESS_environmentName: staging
jobs:
e2e:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
# in the tests below, only the environment
# variable 'environmentName' will be set
- name: Cypress run with env
uses: ./
with:
working-directory: examples/env
spec: cypress/e2e/without-env.cy.js
with-env:
# in the tests below, in addition to 'environmentName'
# we are passing additional environment variables
# using "--env" command line option
# see https://on.cypress.io/configuration
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
with:
working-directory: examples/env
# additional env variables to pass to Cypress specs
# variables are automatically casted
# Cypress.env('host') // 'http://api.dev.local'
# Cypress.env('apiPort') // 4222
env: host=http://api.dev.local,apiPort=4222
spec: cypress/e2e/spec.cy.js
with-action-env:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
# GH Actions workflow syntax allows
# each step to add more environment variables
# via additional "env" blocks
env:
CYPRESS_apiPort: 4222
CYPRESS_host: http://api.dev.local
with:
working-directory: examples/env
spec: cypress/e2e/spec.cy.js
combined-env:
# combination of all 3 ways to pass environment variables
# 'environmentName' value comes from the workflow's environment
# 'apiPort' comes from the step's "env" block
# 'host' is defined in the action's "with: env:" parameter
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
env:
CYPRESS_apiPort: 4222
with:
env: host=http://api.dev.local
working-directory: examples/env
spec: cypress/e2e/spec.cy.js