Skip to content

Commit

Permalink
chore(ci): move test publiccode.yml in a dedicated folder
Browse files Browse the repository at this point in the history
  • Loading branch information
astagi committed Feb 18, 2021
1 parent 855ee01 commit 2b52c0b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ jobs:
with:
fetch-depth: 0
- uses: italia/publiccode-parser-action@v0.0.2-alpha
with:
publiccode: 'data/publiccode.yml'
- name: Parse publiccode.yml
uses: ./
id: pva
with:
publiccode: 'data/publiccode.yml'
- name: Test without tags
run: |
test "" = "${{ steps.pva.outputs.version }}"
Expand All @@ -27,7 +31,9 @@ jobs:
uses: ./
continue-on-error: true
id: pvasecond
with:
publiccode: 'data/publiccode.yml'
- name: Test that version has been committed
run: |
test "v0.3.2" = "${{ steps.pvasecond.outputs.version }}"
test "softwareVersion: v0.3.2" = "$(cat publiccode.yml | grep -Eo 'softwareVersion:(.*)')"
test "softwareVersion: v0.3.2" = "$(cat data/publiccode.yml | grep -Eo 'softwareVersion:(.*)')"
File renamed without changes.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let main = async () => {
try {
const git = simpleGit();
const tag = (await git.tags()).latest
const publiccode = 'publiccode.yml'
const publiccode = core.getInput('publiccode')
let docContent = fs.readFileSync(publiccode, 'utf8')
const doc = yaml.load(docContent)

Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let main = async () => {
try {
const git = simpleGit();
const tag = (await git.tags()).latest
const publiccode = 'publiccode.yml'
const publiccode = core.getInput('publiccode')
let docContent = fs.readFileSync(publiccode, 'utf8')
const doc = yaml.load(docContent)

Expand All @@ -20,7 +20,7 @@ let main = async () => {
git.addConfig('user.email', core.getInput('gitmail'))
docContent = docContent.replace(/softwareVersion:.*/, `softwareVersion: ${tag}`)
fs.writeFileSync(publiccode, docContent, 'utf8')
git.add('./*').commit(`feat: bump ${publiccode} to version ${tag}`)
git.add('.').commit(`feat: bump ${publiccode} to version ${tag}`)
throw `Current ${publiccode} should contain ${tag} version`
}
}
Expand Down

0 comments on commit 2b52c0b

Please sign in to comment.