conventional-changelog-action/.github/workflows/test.yml

421 lines
12 KiB
YAML

name: 'Test the action'
on: [pull_request]
jobs:
test-json:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file.json'
- name: Show file
run: |
echo "$(<test-file.json)"
test-json-new:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.json'
- name: Show file
run: |
echo "$(<test-file-new.json)"
test-json-empty:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: touch ./test-file-empty.json
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.json'
- run: echo "$(<./test-file-empty.json)"
test-pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: test -f pre-commit.test.json && (echo should not be here yet && exit 1) || exit 0
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
pre-commit: './test-pre-commit.js'
skip-on-empty: 'false'
- run: test -f pre-commit.test.json || (echo should be here && exit 1)
- run: cat pre-commit.test.json && echo ""
- run: cat ./package.json
test-pre-changelog-generation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: test -f pre-changelog-generation.test.json && (echo should not be here yet && exit 1) || exit 0
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
pre-changelog-generation: './test-pre-changelog-generation.js'
version-file: './test-file.toml'
version-path: 'package.version'
- run: test -f pre-changelog-generation.version.test.json || (echo should be here && exit 1)
- run: test -f pre-changelog-generation.tag.test.json || (echo should be here && exit 1)
- run: cat pre-changelog-generation.version.test.json && echo ""
- run: cat pre-changelog-generation.tag.test.json && echo ""
- run: cat ./test-file.toml
test-git:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
skip-commit: 'true'
test-git-fallback:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: git tag | xargs git tag -d
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
skip-commit: 'true'
test-yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file.yaml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file.yaml)"
test-yaml-new:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: touch ./test-file-empty.yaml
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.yaml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file-new.yaml)"
test-yaml-empty:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.yaml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file-empty.yaml)"
test-toml:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file.toml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file.toml)"
test-toml-new:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.toml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file-new.toml)"
test-toml-empty:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- run: touch ./test-file-empty.toml
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.toml'
version-path: 'package.version'
- name: Show file
run: |
echo "$(<test-file-empty.toml)"
test-multiple-files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
version-file: 'test-file.json, test-file.toml, test-file.yaml'
- name: Show files
run: |
echo "$(<test-file.json)"
echo "$(<test-file.toml)"
echo "$(<test-file.yaml)"
test-config-file-path:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: touch ./fake-file.log
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit -m 'feat: Added fake file so version will be bumped'"
- name: Generate Changelog
id: changelog
uses: ./
env:
ENV: 'dont-use-git'
with:
github-token: ${{ secrets.github_token }}
skip-version-file: 'true'
config-file-path: './test-changelog.config.js'