add tests
All checks were successful
/ Test-job (push) Successful in 1m38s

This commit is contained in:
Nadezhda Fedorova 2024-04-11 14:50:27 +03:00
parent 55d9707d24
commit 065c19863d
18 changed files with 44 additions and 24 deletions

View File

@ -25,9 +25,7 @@ jobs:
GU: ${{ gitea.server_url }}
GR: ${{ gitea.repository }}
- name: Update apt
run: |
echo "apt-get update -y && apt-get install -y apt rpm"
apt-get update -y && apt-get install -y apt rpm
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah jq"
@ -57,7 +55,7 @@ jobs:
echo "IMAGE=$localimage"
- name: Get test for image
run: |
testscript=$(cat ${{ gitea.workspace }}/org/$IM/test)
if test -f ${{ gitea.workspace }}/org/$IM/test; then testscript=$(cat ${{ gitea.workspace }}/org/$IM/test); else testscript=""; fi
echo "TEST=$testscript">> ${GITHUB_ENV}
env:
IM: ${{ env.IMAGE }}
@ -72,16 +70,13 @@ jobs:
BR: ${{ env.BRANCH }}
continue-on-error: true
test_process:
if: ${{ jobs.build_process.env.BUILDRES == 'success' }}
needs: build_process
runs-on: alt-latest
outputs:
testres: ${{ steps.test_script.outcome }}
testres: ${{ steps.test_script.outcome == 'success' || steps.test_script.outcome == 'success' }}
steps:
- name: Update apt
run: |
echo "apt-get update -y && apt-get install -y apt rpm"
apt-get update -y && apt-get install -y apt rpm
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y python3-module-tomli python3-module-jinja2 podman buildah"
@ -90,21 +85,32 @@ jobs:
apt-get install -y qemu-user-static-binfmt-aarch64 qemu-user-static-binfmt-arm qemu-user-static-binfmt-ppc
- name: Run test
id: test_script
if: ${{ needs.build_process.outputs.buildres == 'success' && needs.build_process.outputs.test != "" }}
continue-on-error: true
uses: https://gitea.basealt.ru/actions/podman-run-action@v2
with:
image: ${{ needs.build_process.outputs.url }}/${{ needs.build_process.outputs.repo }}/${{ needs.build_process.outputs.image }}:${{ needs.build_process.outputs.branch }}
options: --rm
run: ${{ needs.build_process.outputs.test }}
- name: Run special test
id: special_test
if: ${{ jobs.build_process.env.BUILDRES == 'success' && needs.build_process.outputs.test == "" }}
continue-on-error: true
run: |
if [[ IM = "alt/distroless-true" ]]; then podman run --rm $URL/$REPO/$IM:$BR true; fi
if [[ IM = "alt/distroless-gotop" ]]; then podman run --rm $URL/$REPO/$IM:$BR --version; fi
env:
IM: ${{ needs.build_process.outputs.image }}
BR: ${{ needs.build_process.outputs.branch }}
URL: ${{ needs.build_process.outputs.url }}
REPO: ${{ needs.build_process.outputs.repo }}
finish_process:
needs: [ build_process, test_process ]
runs-on: alt-latest
steps:
- name: Update apt
run: |
echo "apt-get update -y && apt-get install -y apt rpm"
apt-get update -y && apt-get install -y apt rpm
- name: Update apt
uses: https://gitea.basealt.ru/actions/init-alt-env@v1
- name: Install requires
run: |
echo "apt-get install -y curl jq"
apt-get install -y curl jq
@ -124,10 +130,10 @@ jobs:
- name: Send comment to issue for notification
run: |
issueid=$(curl -X 'GET' "https://$URL/api/v1/repos/$REPO/gitea-image-forge/issues?state=all&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r)
if [[ ${ needs.build_process.outputs.buildres }} = "success" ]] && [[ ${{ needs.test_process.outputs.testres }} = "success" ]]; then body="Building of image $IM for branch $BR finished success"; else body="Testing of image $IM for branch $BR is failed"; fi
if [[ ${{ needs.build_process.outputs.buildres }} = "success" ]] && [[ ${{ needs.test_process.outputs.testres }} ]]; then body="Building of image $IM for branch $BR finished success"; else body="Testing of image $IM for branch $BR is failed"; fi
if [[ ${{ needs.build_process.outputs.buildres }} != 'success' ]]; then body="Building of image $IM for branch $BR is failed"; fi
curl -X 'POST' "https://$URL/api/v1/repos/$REPO/gitea-image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
echo "notification is sent"
echo "notification is sent to issue $issueid"
env:
T: ${{ secrets.TOKEN }}
URL: ${{ needs.build_process.outputs.url }}

View File

@ -1,4 +1,3 @@
name: Test_wf
on:
push:
tags:
@ -13,11 +12,11 @@ jobs:
- name: Update apt
run: apt-get update -y && apt-get install -y apt rpm
- name: Install reqs
run: apt-get install -y podman buildah
- name: Podman run
uses: https://gitea.basealt.ru/actions/podman-run-action@v2
with:
image: gitea.basealt.ru/images_repo/alt/gitea
options: --rm
run: ${{ env.TEST }}
run: apt-get install -y podman buildah coreutils
- name: checkout
uses: https://gitea.com/actions/checkout@v4
- name: run
run: |
if [test -f "${{ gitea.workspace }}/org/alt/gitea/test"]; then testscript=$(cat ${{ gitea.workspace }}/org/$IM/test); else testscript=""; fi
echo $testscript
- run: echo "This job's status is ${{ job.status }}"

1
org/alt/base/test Normal file
View File

@ -0,0 +1 @@
LC_ALL=ru_RU.UTF-8 TZ=/usr/share/zoneinfo/Europe/Moscow date| grep MSK | grep Чт

View File

@ -0,0 +1 @@
curl --version;gpg --version

View File

@ -0,0 +1 @@
git --version;hg --version

View File

@ -0,0 +1 @@
gcc --version;make --version

1
org/alt/devel/test Normal file
View File

@ -0,0 +1 @@
man --version;ip -V;vim --version | grep vim

View File

@ -0,0 +1 @@
apt-repo --version

View File

@ -0,0 +1 @@
ss -V

1
org/alt/etcd/test Normal file
View File

@ -0,0 +1 @@
etcdctl version

1
org/alt/nginx/test Normal file
View File

@ -0,0 +1 @@
nginx -v

1
org/alt/node/test Normal file
View File

@ -0,0 +1 @@
node -v

1
org/alt/prometheus/test Normal file
View File

@ -0,0 +1 @@
prometheus --version

View File

@ -1 +1 @@
python3 --help
python3 --version

1
org/alt/registry/test Normal file
View File

@ -0,0 +1 @@
registry --version

1
org/alt/ruby/test Normal file
View File

@ -0,0 +1 @@
ruby --version

1
org/alt/systemd/test Normal file
View File

@ -0,0 +1 @@
ls -la /sbin/init | grep systemd

1
org/alt/unit/test Normal file
View File

@ -0,0 +1 @@
unitd --version