Skip to content

Commit

Permalink
feat(experimental-release): create the workflow with a more intent-re…
Browse files Browse the repository at this point in the history
…vealing name
  • Loading branch information
travi committed Aug 23, 2024
1 parent f5448b8 commit 204e9aa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ suite('github release workflow scaffolder', () => {

await scaffoldReleaseWorkflow({projectRoot, nodeVersion});

assert.calledWith(fs.writeFile, `${workflowsDirectory}/release.yml`, dumpedWorkflowYaml);
assert.calledWith(fs.writeFile, `${workflowsDirectory}/experimental-release.yml`, dumpedWorkflowYaml);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function ({projectRoot, nodeVersion}) {
await writeConfigFile({
format: fileTypes.YAML,
path: `${projectRoot}/.github/workflows`,
name: 'release',
name: 'experimental-release',
config: {
name: 'Release',
on: {push: {branches: ['alpha']}},
Expand Down
14 changes: 7 additions & 7 deletions test/integration/features/lift/lifter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Feature: Lift
Given semantic-release is configured
And legacy releases are configured in a GitHub workflow
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the verification workflow calls the reusable release workflow

Scenario: cycjimmy action in a GitHub workflow
Given semantic-release is configured
And the cycjimmy action is configured in a GitHub workflow
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the verification workflow calls the reusable release workflow
And the cycjimmy action was removed

Expand All @@ -20,14 +20,14 @@ Feature: Lift
And the release workflow is called from the ci workflow
And a release workflow is defined for alpha
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches

Scenario: modern semantic-release in GitHub workflows, but trigger does not wait for verification
Given semantic-release is configured
And the release workflow is called from the ci workflow
And a release workflow is defined for alpha
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the release is not called until verification completes

Scenario: modern semantic-release in GitHub workflows verifying multiple node versions, but trigger does not wait for verification
Expand All @@ -36,14 +36,14 @@ Feature: Lift
And a release workflow is defined for alpha
And multiple node versions are verified
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the release is not called until verification completes

Scenario: no existing release
Given semantic-release is configured
And no release is configured in a GitHub workflow
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the verification workflow calls the reusable release workflow

Scenario: no release needed
Expand All @@ -64,5 +64,5 @@ Feature: Lift
And a local release workflow is defined
And the release workflow is triggered from the ci workflow
When the project is lifted
Then the release workflow calls the reusable workflow for alpha branches
Then the experimental release workflow calls the reusable workflow for alpha branches
And the verification workflow calls the reusable release workflow
2 changes: 1 addition & 1 deletion test/integration/features/lift/older-node.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Feature: older node version
And semantic-release is configured
And no release is configured in a GitHub workflow
When the project is lifted
Then the release workflow calls the reusable workflow for semantic-release v19 for alpha branches
Then the experimental release workflow calls the reusable workflow for semantic-release v19 for alpha branches
And the verification workflow calls the reusable release workflow for semantic-release v19
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import {assert} from 'chai';
import {load} from 'js-yaml';

async function loadReleaseWorkflowDefinition() {
assert.isTrue(await fileExists(`${process.cwd()}/.github/workflows/release.yml`), 'Release workflow is missing');
assert.isTrue(
await fileExists(`${process.cwd()}/.github/workflows/experimental-release.yml`),
'Release workflow is missing'
);

const {on: triggers, jobs} = load(await fs.readFile(`${process.cwd()}/.github/workflows/release.yml`, 'utf-8'));
const {on: triggers, jobs} = load(
await fs.readFile(`${process.cwd()}/.github/workflows/experimental-release.yml`, 'utf-8')
);

return {triggers, jobs};
}
Expand Down Expand Up @@ -68,21 +73,27 @@ Given('no GitHub workflows exist', async function () {
this.githubWorkflows = false;
});

Then('the release workflow calls the reusable workflow for alpha branches', async function () {
Then('the experimental release workflow calls the reusable workflow for alpha branches', async function () {
const {triggers, jobs} = await loadReleaseWorkflowDefinition();

assert.isUndefined(triggers.workflow_dispatch);
assert.deepEqual(triggers.push.branches, ['alpha']);
assert.equal(jobs.release.uses, 'form8ion/.github/.github/workflows/release-package.yml@master');
});

Then('the release workflow calls the reusable workflow for semantic-release v19 for alpha branches', async function () {
const {triggers, jobs} = await loadReleaseWorkflowDefinition();
Then(
'the experimental release workflow calls the reusable workflow for semantic-release v19 for alpha branches',
async function () {
const {triggers, jobs} = await loadReleaseWorkflowDefinition();

assert.isUndefined(triggers.workflow_dispatch);
assert.deepEqual(triggers.push.branches, ['alpha']);
assert.equal(jobs.release.uses, 'form8ion/.github/.github/workflows/release-package-semantic-release-19.yml@master');
});
assert.isUndefined(triggers.workflow_dispatch);
assert.deepEqual(triggers.push.branches, ['alpha']);
assert.equal(
jobs.release.uses,
'form8ion/.github/.github/workflows/release-package-semantic-release-19.yml@master'
);
}
);

Then('the release workflow is not defined', async function () {
assert.isFalse(await fileExists(`${process.cwd()}/.github/workflows/release.yml`));
Expand Down

0 comments on commit 204e9aa

Please sign in to comment.