diff --git a/.gitea/workflows/build-feature.yml b/.gitea/workflows/build-feature.yml index b0bdac8..e8d5322 100644 --- a/.gitea/workflows/build-feature.yml +++ b/.gitea/workflows/build-feature.yml @@ -5,33 +5,37 @@ on: bats-image: required: false type: string + default: bats/bats:latest + cucumber-node-image: + required: false + type: string + default: node:20 jobs: - pipeline: + bats: runs-on: ubuntu-latest env: - GITEA_API_URL: https://gitea.app.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: - 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 run: | 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 - 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 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 run: | mkdir -p "reports/${GITHUB_SHA:0:8}/cucumber" @@ -41,6 +45,20 @@ jobs: npx cucumber-js \ --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 run: | SHA8="${GITHUB_SHA:0:8}" @@ -66,13 +84,6 @@ jobs: echo "" } > "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 run: | bash .ci/scripts/publish-git-pages.sh "reports/${GITHUB_SHA:0:8}"