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

test: adds tests for release of repos and monorepos #1254

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
7 changes: 6 additions & 1 deletion test/fixtures/projects/a-monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
"version": "1.0.0",
"description": "",
"homepage": "https://github.com/ipfs/aegir#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs-shipyard/empty-repository.git"
},
"scripts": {
"docs": "aegir docs"
"docs": "aegir docs",
"release": "aegir run release"
},
"workspaces": [
"packages/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,92 @@
"license": "ISC",
"typedoc": {
"entryPoint": "./src/index.js"
},
"scripts": {
"release": "aegir release"
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,92 @@
"license": "ISC",
"typedoc": {
"entryPoint": "./src/index.js"
},
"scripts": {
"release": "aegir release"
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
}
103 changes: 102 additions & 1 deletion test/fixtures/projects/an-esm-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
"version": "1.0.0",
"description": "",
"homepage": "https://github.com/ipfs/aegir#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs-shipyard/empty-repository.git"
},
"exports": {
".": {
"import": "./src/index.js"
}
},
"type": "module",
"scripts": {
"test": "aegir test"
"test": "aegir test",
"release": "aegir release"
},
"author": "",
"license": "ISC",
Expand All @@ -23,5 +28,101 @@
"devDependencies": {
"@types/mocha": "^10.0.1",
"mocha": "^10.0.0"
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
}
1 change: 1 addition & 0 deletions test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ import './utils/echo-server.js'
import './utils/get-port.js'
import './config/user.js'
import './test.js'
import './release.js'
57 changes: 57 additions & 0 deletions test/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* eslint-env mocha */

import { execa } from 'execa'
import { expect } from '../utils/chai.js'
import { setUpProject } from './utils/set-up-project.js'

describe('release', () => {
describe('regular repo', function () {
let projectDir = ''

before(async () => {
projectDir = await setUpProject('an-esm-project')
})

it('should release an esm project', async function () {
this.timeout(120 * 1000) // slow ci is slow

const output = await execa('npm', ['run', 'release', '--', '--', '--dry-run'], {
cwd: projectDir,
env: {
...process.env,
GITHUB_ACTIONS: '',
CI: ''
}
})

console.info('output.stdout', output.stdout) // eslint-disable-line no-console
console.info('output.stderr', output.stderr) // eslint-disable-line no-console
expect(output.stdout).to.include('Published release 1.0.0 on default channel')
})
})

describe('monorepo', function () {
let projectDir = ''

before(async () => {
projectDir = await setUpProject('a-monorepo')
})

it('should release a monorepo project', async function () {
this.timeout(120 * 1000) // slow ci is slow

const output = await execa('npm', ['run', 'release', '--', '--', '--dry-run'], {
cwd: projectDir,
env: {
...process.env,
GITHUB_ACTIONS: '',
CI: ''
}
})

console.info('output.stdout', output.stdout) // eslint-disable-line no-console
console.info('output.stderr', output.stderr) // eslint-disable-line no-console
expect(output.stdout).to.include('Published release 1.0.0 on default channel')
})
})
})
Loading