This commit is contained in:
@@ -5,33 +5,37 @@ on:
|
|||||||
bats-image:
|
bats-image:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
default: bats/bats:latest
|
||||||
|
cucumber-node-image:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: node:20
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pipeline:
|
bats:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GITEA_API_URL: https://gitea.app.keskikuja.site
|
|
||||||
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
|
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
|
||||||
GIT_PAGES_PUBLISH_URL: https://ci-reports.helm-dev.keskikuja.site
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: niko/gitea-ci-library
|
|
||||||
path: .ci
|
|
||||||
|
|
||||||
- name: Bats tests
|
- name: Run bats tests
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
mkdir -p "reports/${GITHUB_SHA:0:8}/bats"
|
||||||
docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 || true
|
docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/results.txt" 2>&1 || true
|
||||||
if [ -f "tests/*.bats" ]; then
|
if ls tests/*.bats 1> /dev/null 2>&1; then
|
||||||
docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} --formatter junit /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/junit.xml" 2>&1 || true
|
docker run --rm -v "$PWD:/code" ${{ inputs.bats-image }} --formatter junit /code/tests/*.bats > "reports/${GITHUB_SHA:0:8}/bats/junit.xml" 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Cucumber tests
|
cucumber:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run cucumber tests
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
mkdir -p "reports/${GITHUB_SHA:0:8}/cucumber"
|
mkdir -p "reports/${GITHUB_SHA:0:8}/cucumber"
|
||||||
@@ -41,6 +45,20 @@ jobs:
|
|||||||
npx cucumber-js \
|
npx cucumber-js \
|
||||||
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json"
|
--format json:"reports/${GITHUB_SHA:0:8}/cucumber/report.json"
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [bats, cucumber]
|
||||||
|
env:
|
||||||
|
PAGES_HOST: ci-reports.helm-dev.keskikuja.site
|
||||||
|
GIT_PAGES_PUBLISH_URL: https://ci-reports.helm-dev.keskikuja.site
|
||||||
|
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: niko/gitea-ci-library
|
||||||
|
path: .ci
|
||||||
|
|
||||||
- name: Generate report index
|
- name: Generate report index
|
||||||
run: |
|
run: |
|
||||||
SHA8="${GITHUB_SHA:0:8}"
|
SHA8="${GITHUB_SHA:0:8}"
|
||||||
@@ -66,13 +84,6 @@ jobs:
|
|||||||
echo "</table></body></html>"
|
echo "</table></body></html>"
|
||||||
} > "reports/${SHA8}/index.html"
|
} > "reports/${SHA8}/index.html"
|
||||||
|
|
||||||
- name: Set commit status
|
|
||||||
run: |
|
|
||||||
bash .ci/scripts/report-status.sh success \
|
|
||||||
"Tests passed" \
|
|
||||||
"https://${PAGES_HOST}/${GITHUB_REPOSITORY}/reports/${GITHUB_SHA:0:8}/" \
|
|
||||||
ci-tests
|
|
||||||
|
|
||||||
- name: Publish reports
|
- name: Publish reports
|
||||||
run: |
|
run: |
|
||||||
bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}"
|
bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}"
|
||||||
|
|||||||
Reference in New Issue
Block a user