Skip to content

Support arbitary environment variables in job configuration #12

@jelhan

Description

@jelhan

So far only EMBER_CLI_SCENARIO environment variable is extracted from .travis.yml configuration and used to generate the GitHub Action CI:

const emberTryScenarios: string[] = config.jobs.include
.map(({ env }: { env: unknown }): string | null => {
if (typeof env !== 'string') {
return null;
}
const [key, value] = env.split('=');
return key === 'EMBER_TRY_SCENARIO' ? value : null;
})
.filter((_: string | null) => _ !== null);
ember-try-scenario: [<%
emberTryScenarios.required.forEach(function(scenario, index){ %>
<%- scenario %><% if (index < emberTryScenarios.required.length - 1) { %>,<% }}); %>
]

It should be possible to migrate every environment variable defined in TravisCI in that way to GitHub Actions. Instead of ignoring all environment variables, which aren't EMBER_CLI_SCENARIO, we could use a key value map to store them and loop over it in the GitHub Actions creation.

We would need to change the configuration used to generate GitHub Actions.

const data: ConfigurationInterface = parseTravisCiConfig() ?? {
browsers: ['chrome', 'firefox'],
emberTryScenarios: {
required: [
'ember-lts-3.16',
'ember-lts-3.20',
'ember-release',
'ember-beta',
'ember-default-with-jquery',
'ember-classic',
],
allowedToFail: ['ember-canary', 'embroider-tests'],
},
nodeVersion: '10.x',
packageManager: 'yarn',
};

Maybe something like this:

 const data: ConfigurationInterface = parseTravisCiConfig() ?? {
   browsers: ['chrome', 'firefox'],
-  emberTryScenarios: {
-    required: [
-      'ember-lts-3.16',
-      'ember-lts-3.20',
-      'ember-release',
-      'ember-beta',
-      'ember-default-with-jquery',
-      'ember-classic',
-    ],
-    allowedToFail: ['ember-canary', 'embroider-tests'],
-  },
+ jobs: [
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'ember-lts-3.16',
+     },
+     allowedToFail: false,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'ember-lts-3.20',
+     },
+     allowedToFail: false,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'ember-release',
+     },
+     allowedToFail: false,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'ember-beta',
+     },
+     allowedToFail: false,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'default-with-jquery',
+     },
+     allowedToFail: false,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'ember-canary',
+     },
+     allowedToFail: true,
+   },
+   {
+     environmentVariables: {
+       EMBER_CLI_SCENARIO: 'embroider-tests',
+     },
+     allowedToFail: true,
+   },
+ ]
   nodeVersion: '10.x',
   packageManager: 'yarn',
 };

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions