ci: Improve test scripts
parent
0fc388f4a3
commit
9f9635115e
|
@ -15,6 +15,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -50,6 +53,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -85,6 +91,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -120,6 +129,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
|
||||||
|
@ -139,34 +151,6 @@ jobs:
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
skip-commit: 'true'
|
skip-commit: 'true'
|
||||||
|
|
||||||
test-git-no-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
path: "./"
|
|
||||||
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
|
||||||
|
|
||||||
- run: git tag | xargs git tag -d
|
|
||||||
- name: Create fake tag
|
|
||||||
run: "git tag -a 'v0.55.8' -m 'v0.55.8'"
|
|
||||||
- run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'"
|
|
||||||
|
|
||||||
- name: Generate changelog
|
|
||||||
id: changelog
|
|
||||||
uses: ./
|
|
||||||
env:
|
|
||||||
ENV: 'dont-use-git'
|
|
||||||
EXPECTED_TAG: 'v0.55.9'
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.github_token }}
|
|
||||||
git-push: 'false'
|
|
||||||
|
|
||||||
test-git-fallback:
|
test-git-fallback:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -177,6 +161,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -195,6 +182,40 @@ jobs:
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
skip-commit: 'true'
|
skip-commit: 'true'
|
||||||
|
|
||||||
|
test-git-no-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: "./"
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
|
||||||
|
- run: git tag | xargs git tag -d
|
||||||
|
- name: Create fake tag
|
||||||
|
run: "git tag -a 'v0.55.8' -m 'v0.55.8'"
|
||||||
|
- run: "git add . && git commit -m 'fix: Added fake file so version will be bumped'"
|
||||||
|
|
||||||
|
- name: Generate changelog
|
||||||
|
id: changelog
|
||||||
|
uses: ./
|
||||||
|
env:
|
||||||
|
ENV: 'dont-use-git'
|
||||||
|
EXPECTED_TAG: 'v0.55.9'
|
||||||
|
SKIPPED_COMMIT: true
|
||||||
|
EXPECTED_NO_PUSH: true
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.github_token }}
|
||||||
|
skip-commit: 'true'
|
||||||
|
git-push: 'false'
|
||||||
|
|
||||||
test-yaml:
|
test-yaml:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -205,6 +226,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -276,6 +300,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -315,6 +342,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -352,6 +382,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -389,6 +422,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -426,6 +462,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -466,6 +505,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -499,6 +541,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -534,6 +579,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
@ -576,6 +624,9 @@ jobs:
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: rm -rf node_modules
|
||||||
|
- run: npm ci --prod
|
||||||
|
|
||||||
- run: touch ./fake-file.log
|
- run: touch ./fake-file.log
|
||||||
- run: "git config --global user.email 'changelog@github.com'"
|
- run: "git config --global user.email 'changelog@github.com'"
|
||||||
- run: "git config --global user.name 'Awesome Github action'"
|
- run: "git config --global user.name 'Awesome Github action'"
|
||||||
|
|
|
@ -159,9 +159,9 @@ module.exports = new (class Git {
|
||||||
/**
|
/**
|
||||||
* Validates the commands run
|
* Validates the commands run
|
||||||
*/
|
*/
|
||||||
testHistory = (gitPush) => {
|
testHistory = () => {
|
||||||
if (ENV === 'dont-use-git') {
|
if (ENV === 'dont-use-git') {
|
||||||
const { EXPECTED_TAG, SKIPPED_COMMIT } = process.env
|
const { EXPECTED_TAG, SKIPPED_COMMIT, EXPECTED_NO_PUSH } = process.env
|
||||||
|
|
||||||
const expectedCommands = [
|
const expectedCommands = [
|
||||||
'git config user.name "Conventional Changelog Action"',
|
'git config user.name "Conventional Changelog Action"',
|
||||||
|
@ -176,15 +176,10 @@ module.exports = new (class Git {
|
||||||
|
|
||||||
expectedCommands.push(`git tag -a ${EXPECTED_TAG} -m "${EXPECTED_TAG}"`)
|
expectedCommands.push(`git tag -a ${EXPECTED_TAG} -m "${EXPECTED_TAG}"`)
|
||||||
|
|
||||||
if (gitPush) {
|
if (!EXPECTED_NO_PUSH) {
|
||||||
expectedCommands.push(`git push origin ${branch} --follow-tags`)
|
expectedCommands.push(`git push origin ${branch} --follow-tags`)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Testing GIT history')
|
|
||||||
console.log(this.commandsRun)
|
|
||||||
console.log('Should equal')
|
|
||||||
console.log(expectedCommands)
|
|
||||||
|
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
this.commandsRun,
|
this.commandsRun,
|
||||||
expectedCommands,
|
expectedCommands,
|
||||||
|
|
|
@ -199,7 +199,7 @@ async function run() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If we are running in test mode we use this to validate everything still runs
|
// If we are running in test mode we use this to validate everything still runs
|
||||||
git.testHistory(gitPush)
|
git.testHistory()
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
Loading…
Reference in New Issue