Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ember): Restore local and PR tests #4205

Merged
merged 2 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,9 @@ jobs:
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Check changed files
id: changed-files-specific
uses: tj-actions/changed-files@v6.2
with:
files: .*packages\/ember($|/.*)
# Only run ember tests if the files above have changed
- name: Run Ember tests
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push'
run: yarn test --scope=@sentry/ember
- name: Compute test coverage
if: steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push'
uses: codecov/codecov-action@v1

job_artifacts:
Expand Down
51 changes: 38 additions & 13 deletions packages/ember/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,47 @@
const getChannelURL = require('ember-source-channel-url');
const { embroiderSafe } = require('@embroider/test-setup');

/**
* Pick which versions of ember against which to test based on whether the tests are running locally, as part of a PR,
* or when merging to `master` or creating a release.
*
* @returns The versions which should be tested, along with their respective config
*/
module.exports = async function() {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-3.20',
npm: {
devDependencies: {
'ember-source': '~3.20.0',
},
// whenever and wherever we test, we want to at least test against the latest version of ember
let scenarios = [
{
name: 'ember-release',
npm: {
devDependencies: {
'ember-source': await getChannelURL('release'),
},
},
},
];

// in CI we add a few more tests - LTS and embroider (which is an ember compiler)
if (process.env.GITHUB_ACTIONS) {
scenarios = scenarios.concat([
{
name: 'ember-release',
name: 'ember-lts-3.20',
npm: {
devDependencies: {
'ember-source': await getChannelURL('release'),
'ember-source': '~3.24.0',
},
},
},
embroiderSafe(),
]);
}

// finally, just to be extra thorough when merging to master and releasing, we add the beta channel and ember
// "classic" (a legacy version which was last current in late 2019)
if (
process.env.GITHUB_EVENT_NAME === 'push' &&
(process.env.GITHUB_HEAD_REF === 'master' || process.env.GITHUB_HEAD_REF.startsWith('release'))
) {
scenarios = scenarios.concat([
{
name: 'ember-beta',
npm: {
Expand All @@ -32,7 +53,6 @@ module.exports = async function() {
},
allowedToFail: true,
},
embroiderSafe(),
{
name: 'ember-classic',
env: {
Expand All @@ -48,6 +68,11 @@ module.exports = async function() {
},
},
},
],
]);
}

return {
useYarn: true,
scenarios,
};
};
5 changes: 2 additions & 3 deletions packages/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
"prepublishOnly": "ember ts:precompile",
"postpublish": "ember ts:clean",
"start": "ember serve",
"test": "node ./scripts/run_tests.js",
"test:ember": "ember test",
"test:ember-compatibility": "ember try:each"
"test": "ember try:each",
"test:all": "node ./scripts/run-CI-tests.js"
},
"dependencies": {
"@embroider/macros": "~0.47.2",
Expand Down
17 changes: 17 additions & 0 deletions packages/ember/scripts/run-CI-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*eslint-env node*/
const { spawnSync } = require('child_process');

console.log('Mimicking the CI environment in order to run tests against multiple versions of Ember');

const result = spawnSync('yarn test', {
shell: true,
stdio: 'inherit',
env: {
...process.env,
GITHUB_ACTIONS: true,
GITHUB_EVENT_NAME: 'push',
GITHUB_HEAD_REF: 'master',
},
});

process.exit(result.status);
15 changes: 0 additions & 15 deletions packages/ember/scripts/run_tests.js

This file was deleted.