refaktorointia
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 18s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m39s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 1m5s
CI Feature / Report Summary (push) Successful in 4s
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 18s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m39s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 1m5s
CI Feature / Report Summary (push) Successful in 4s
This commit is contained in:
@@ -1,34 +0,0 @@
|
|||||||
name: CI Validate
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
env_json:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
config_path:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
secrets:
|
|
||||||
GITEA_TOKEN:
|
|
||||||
required: true
|
|
||||||
GIT_PAGES_PUBLISH_TOKEN:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITEA_API_URL: ${{ fromJson(inputs.env_json).GITEA_API_URL }}
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
|
|
||||||
CI_CONF_FILE: ${{ inputs.config_path }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: niko/gitea-ci-library
|
|
||||||
path: .ci
|
|
||||||
|
|
||||||
- name: Validate CI config
|
|
||||||
run: bash .ci/scripts/ci-validate.sh
|
|
||||||
@@ -1,16 +1,26 @@
|
|||||||
name: Config Provider Library
|
name: Config Provider
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
config_path:
|
config_path:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
secrets:
|
||||||
|
GITEA_TOKEN:
|
||||||
|
required: true
|
||||||
|
GIT_PAGES_PUBLISH_TOKEN:
|
||||||
|
required: true
|
||||||
outputs:
|
outputs:
|
||||||
env_json:
|
env_json:
|
||||||
value: ${{ jobs.parse-config.outputs.json_data }}
|
value: ${{ jobs.parse-config.outputs.json_data }}
|
||||||
config_path:
|
config_path:
|
||||||
value: ${{ jobs.parse-config.outputs.config_path }}
|
value: ${{ jobs.parse-config.outputs.config_path }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI_CONF_FILE: ${{ inputs.config_path }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GIT_PAGES_PUBLISH_TOKEN: ${{ secrets.GIT_PAGES_PUBLISH_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
parse-config:
|
parse-config:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -19,6 +29,13 @@ jobs:
|
|||||||
config_path: ${{ steps.set-path.outputs.CONFIG_PATH }}
|
config_path: ${{ steps.set-path.outputs.CONFIG_PATH }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: niko/gitea-ci-library
|
||||||
|
path: .ci
|
||||||
|
|
||||||
|
- name: Validate CI config
|
||||||
|
run: bash .ci/scripts/ci-validate.sh
|
||||||
|
|
||||||
- id: convert
|
- id: convert
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -38,11 +38,6 @@ jobs:
|
|||||||
repository: niko/gitea-ci-library
|
repository: niko/gitea-ci-library
|
||||||
path: .ci
|
path: .ci
|
||||||
|
|
||||||
- name: Set Gitea status to PENDING
|
|
||||||
run: |
|
|
||||||
echo "===== gitea-ci-library - Docker Build & Push | begin ====="
|
|
||||||
bash .ci/scripts/report-status.sh pending "Building and pushing Docker image..." ci-docker-build-push
|
|
||||||
|
|
||||||
- name: Build and push container
|
- name: Build and push container
|
||||||
env:
|
env:
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME || github.actor }}
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ jobs:
|
|||||||
repository: niko/gitea-ci-library
|
repository: niko/gitea-ci-library
|
||||||
path: .ci
|
path: .ci
|
||||||
|
|
||||||
- name: Pending
|
|
||||||
run: bash .ci/scripts/report-status.sh pending "Running Bats tests..." ci-bats
|
|
||||||
|
|
||||||
- name: Run bats tests
|
- name: Run bats tests
|
||||||
id: bats-tests
|
id: bats-tests
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -61,7 +58,7 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ "${BATS_EXIT}" = "0" ]; then
|
if [ "${BATS_EXIT}" = "0" ]; then
|
||||||
bash .ci/scripts/report-status.sh success "Bats tests OK" ci-bats bats
|
bash .ci/scripts/report-status.sh success "Link to Bats reports" unit-tests bats
|
||||||
else
|
else
|
||||||
bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats
|
bash .ci/scripts/report-status.sh failure "Link to Bats reports" unit-tests bats
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ jobs:
|
|||||||
repository: niko/gitea-ci-library
|
repository: niko/gitea-ci-library
|
||||||
path: .ci
|
path: .ci
|
||||||
|
|
||||||
- name: Pending
|
|
||||||
run: bash .ci/scripts/report-status.sh pending "Running Cucumber tests..." ci-cucumber
|
|
||||||
|
|
||||||
- name: Run cucumber tests
|
- name: Run cucumber tests
|
||||||
id: cucumber-tests
|
id: cucumber-tests
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -60,14 +57,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
if [ "${CUCUMBER_EXIT}" = "0" ]; then
|
if [ "${CUCUMBER_EXIT}" = "0" ]; then
|
||||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber cucumber
|
bash .ci/scripts/report-status.sh success "Link to Cucumber reports" acc-tests cucumber
|
||||||
else
|
else
|
||||||
bash .ci/scripts/report-status.sh success "Cucumber tests OK" ci-cucumber
|
bash .ci/scripts/report-status.sh success "Link to Cucumber reports" acc-tests
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
if [ -f "reports/${GITHUB_SHA:0:8}/cucumber/index.html" ]; then
|
||||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber cucumber
|
bash .ci/scripts/report-status.sh failure "Link to Cucumber reports" acc-tests cucumber
|
||||||
else
|
else
|
||||||
bash .ci/scripts/report-status.sh failure "Cucumber tests FAILED" ci-cucumber
|
bash .ci/scripts/report-status.sh failure "Link to Cucumber reports" acc-tests
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,18 +8,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
load-config:
|
load-config:
|
||||||
name: Load example-gitea-env.conf to pipeline env
|
name: Load example-gitea-env.conf to pipeline env
|
||||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@feature/docker-kuntoon
|
||||||
with:
|
|
||||||
config_path: .gitea/workflows/example-gitea-env.conf
|
|
||||||
|
|
||||||
validate:
|
|
||||||
name: Validate CI config
|
|
||||||
needs: [load-config]
|
|
||||||
uses: niko/gitea-ci-library/.gitea/workflows/ci-validate.yml@feature/docker-kuntoon
|
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
config_path: .gitea/workflows/example-gitea-env.conf
|
||||||
config_path: ${{ needs.load-config.outputs.config_path }}
|
|
||||||
|
|
||||||
bats:
|
bats:
|
||||||
name: Bats tests
|
name: Bats tests
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
load-config:
|
load-config:
|
||||||
name: Load example-gitea-env.conf to pipeline env
|
name: Load example-gitea-env.conf to pipeline env
|
||||||
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@main
|
uses: niko/gitea-ci-library/.gitea/workflows/config-provider.yml@feature/docker-kuntoon
|
||||||
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
config_path: .gitea/workflows/example-gitea-env.conf
|
config_path: .gitea/workflows/example-gitea-env.conf
|
||||||
|
|
||||||
@@ -20,16 +21,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
env_json: ${{ needs.load-config.outputs.env_json }}
|
||||||
|
|
||||||
validate:
|
|
||||||
name: Validate CI config
|
|
||||||
needs: [load-config, check-version]
|
|
||||||
if: needs.check-version.outputs.artifact_exists != 'true'
|
|
||||||
uses: niko/gitea-ci-library/.gitea/workflows/ci-validate.yml@feature/docker-kuntoon
|
|
||||||
secrets: inherit
|
|
||||||
with:
|
|
||||||
env_json: ${{ needs.load-config.outputs.env_json }}
|
|
||||||
config_path: ${{ needs.load-config.outputs.config_path }}
|
|
||||||
|
|
||||||
bats:
|
bats:
|
||||||
name: Bats tests
|
name: Bats tests
|
||||||
needs: [load-config, check-version]
|
needs: [load-config, check-version]
|
||||||
|
|||||||
@@ -22,13 +22,10 @@ Ei API-kutsuja. Luotetaan Gitean omaan job-statukseen.
|
|||||||
API:a käytetään raporttilinkin upottamiseksi commit-näkymään.
|
API:a käytetään raporttilinkin upottamiseksi commit-näkymään.
|
||||||
|
|
||||||
```
|
```
|
||||||
PENDING → testit → publish (always) → status (always, exit-koodin mukaan)
|
testit → publish (always) → status (always, exit-koodin mukaan)
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Set Gitea status to PENDING
|
|
||||||
run: bash .ci/scripts/report-status.sh pending "Running tests..." ci-bats
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -46,9 +43,9 @@ PENDING → testit → publish (always) → status (always, exit-koodin mukaan)
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ "${EXIT}" = "0" ]; then
|
if [ "${EXIT}" = "0" ]; then
|
||||||
bash .ci/scripts/report-status.sh success "Bats tests OK" ci-bats bats
|
bash .ci/scripts/report-status.sh success "Link to Bats reports" unit-tests bats
|
||||||
else
|
else
|
||||||
bash .ci/scripts/report-status.sh failure "Bats tests FAILED" ci-bats bats
|
bash .ci/scripts/report-status.sh failure "Link to Bats reports" unit-tests bats
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -57,13 +54,13 @@ PENDING → testit → publish (always) → status (always, exit-koodin mukaan)
|
|||||||
API:a käytetään Docker registry -linkin upottamiseksi.
|
API:a käytetään Docker registry -linkin upottamiseksi.
|
||||||
|
|
||||||
```
|
```
|
||||||
PENDING → build → push → SUCCESS (registry-linkillä) / FAILURE
|
build → push → SUCCESS (registry-linkillä) / FAILURE
|
||||||
```
|
```
|
||||||
|
|
||||||
## Periaatteet
|
## Periaatteet
|
||||||
|
|
||||||
1. Gitea Actionsin natiivi job-status on ensisijainen. API:a käytetään vain
|
1. Gitea Actionsin natiivi job-status on ensisijainen — myös PENDING/Running-tila
|
||||||
custom-linkin tarpeeseen (ADR 0004).
|
tulee natiivisti. API:a käytetään vain custom-linkin tarpeeseen (ADR 0004).
|
||||||
2. `run`-komennon on nostettava virhe ylös — oli kyse tool-callista tai
|
2. `run`-komennon on nostettava virhe ylös — oli kyse tool-callista tai
|
||||||
testivirheestä (ADR 0008).
|
testivirheestä (ADR 0008).
|
||||||
3. Test-jobit käyttävät `if: always()` publish- ja status-stepeissä — raportti
|
3. Test-jobit käyttävät `if: always()` publish- ja status-stepeissä — raportti
|
||||||
|
|||||||
Reference in New Issue
Block a user