diff --git a/.gitea/workflows/show-logs.yml b/.gitea/workflows/show-logs.yml deleted file mode 100644 index 4a55918b3..000000000 --- a/.gitea/workflows/show-logs.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Show CI Logs - -on: - workflow_run: - workflows: ["Run CI Tests"] - types: - - completed - -jobs: - show: - runs-on: ubuntu-latest - steps: - - name: Checkout code - run: | - chmod +x temp-ci/give_runs_log.sh - ./temp-ci/give_runs_log.sh "outputs/checkout.log" - - - name: Sudo install - run: | - ./temp-ci/give_runs_log.sh "outputs/sudo-install.log" - - - name: Sudo versions - run: | - ./temp-ci/give_runs_log.sh "outputs/sudo-versions.log" - - - name: Env download - run: | - ./temp-ci/give_runs_log.sh "outputs/env-setup.log" - - - name: Env versions - run: | - ./temp-ci/give_runs_log.sh "outputs/env-versions.log" - - - name: Add of CI pytest tools - run: | - ./temp-ci/give_runs_log.sh "outputs/ci-tooling.log" - - - name: Run command shell before tests - run: | - ./temp-ci/give_runs_log.sh "outputs/custom-shell-before.log" - - - name: Run tests and generate reports - run: | - ./temp-ci/give_runs_log.sh "outputs/test-ci.log" - - - name: Capture Test Prints - run: | - ./temp-ci/give_runs_log.sh "outputs/test-prints.log" - - - name: Run command shell after tests - run: | - ./temp-ci/give_runs_log.sh "outputs/custom-shell-after.log" - - - name: Prepare the push to wiki - run: | - ./temp-ci/give_runs_log.sh "outputs/wiki-clone.log" - - - name: Commit to wiki - run: | - ./temp-ci/give_runs_log.sh "outputs/commit-push-wiki.log" - - - name: Wiki report URLs - run: | - ./temp-ci/give_runs_log.sh "outputs/wiki-report-urls.log" \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 000000000..61e5892ad --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,149 @@ +name: Run CI Tests + +on: + push: + branches: [test_actions_on_utils] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout test-ci repo + uses: actions/checkout@v4 + with: + repository: tligui_y/test-ci + ref: main + path: test-ci + + - name: Follow Code Progress + uses: ./test-ci + with: + ci-branch: test_actions_on_utils + module-dir: slic + gitea-domain: gitea.psi.ch + repo-path: tligui_y/slic + ci-token: ${{ secrets.CI_TOKEN }} + apt_packages: "postfix meson ninja-build build-essential gcc libdbus-1-dev python3-pip dunst xvfb tmux" + custom_shell_commands_before: | + # for elog + + pixi add pip + pixi run pip install git+https://github.com/paulscherrerinstitute/py_elog.git + bash install_elog.sh + + # for IOC + + git clone --depth 1 https://gitea.psi.ch/SwissFEL/morbidissimo.git + + if [ -d morbidissimo/src/morbidissimo ]; then + echo "PYTHONPATH=$(pwd)/morbidissimo/src:$(pwd)" >> $GITHUB_ENV + elif [ -d morbidissimo/morbidissimo ]; then + echo "PYTHONPATH=$(pwd)/morbidissimo:$(pwd)" >> $GITHUB_ENV + fi + + [ -f tests/ioc_plugin.py ] && cp tests/ioc_plugin.py ioc_plugin.py + echo "PYTEST_ADDOPTS=-p ioc_plugin" >> $GITHUB_ENV + echo "TEST_PV_PREFIX=TEST:" >> $GITHUB_ENV + + echo "EPICS_CA_AUTO_ADDR_LIST=NO" >> $GITHUB_ENV + echo "EPICS_CA_ADDR_LIST=127.0.0.1" >> $GITHUB_ENV + echo "EPICS_CA_CONN_TMO=0.5" >> $GITHUB_ENV + + # for send mail + + sudo postconf -e myhostname=localhost + sudo postconf -e 'mydestination=localhost.localdomain, localhost, swissphone-gateway.com' + sudo postconf -e inet_interfaces=loopback-only + sudo postconf -e home_mailbox=Maildir/ + sudo service postfix restart + + mkdir -p ~/Maildir/{cur,new,tmp} + + sudo service postfix restart + + postconf -n | egrep 'myhostname|mydestination|inet_interfaces|home_mailbox' + ls -ld ~/Maildir ~/Maildir/{cur,new,tmp} + + printf "Subject: probe\nTo: $(whoami)@localhost\n\nhi\n" | sendmail -v "$(whoami)@localhost" + # Then: + ls ~/Maildir/new + + test-run-cmd: | + dbus-run-session -- bash -c ' + + set -e + set -x + Xvfb :99 -screen 0 1024x768x24 & + XVFB_PID=$! + export DISPLAY=:99 + + dunst -print & + DUNST_PID=$! + sleep 1 + + # MAIN + tmux new-session -d -s ci "bash -lc \"eval \\\"$CMD\\\"; tmux wait-for -S done\"" + sleep 1 + tmux wait-for done + + kill $DUNST_PID + kill $XVFB_PID + sleep 1 + ' + continue-on-error: true + +##################################### TO NOT CHANGE ################################# + + - name: Checkout code + run: | + chmod +x temp-ci/give_runs_log.sh + ./temp-ci/give_runs_log.sh "outputs/checkout.log" + + - name: Sudo install + run: | + ./temp-ci/give_runs_log.sh "outputs/sudo-install.log" + + - name: Sudo versions + run: | + ./temp-ci/give_runs_log.sh "outputs/sudo-versions.log" + + - name: Env download + run: | + ./temp-ci/give_runs_log.sh "outputs/env-setup.log" + + - name: Env versions + run: | + ./temp-ci/give_runs_log.sh "outputs/env-versions.log" + + - name: Add of CI pytest tools + run: | + ./temp-ci/give_runs_log.sh "outputs/ci-tooling.log" + + - name: Run command shell before tests + run: | + ./temp-ci/give_runs_log.sh "outputs/custom-shell-before.log" + + - name: Run tests and generate reports + run: | + ./temp-ci/give_runs_log.sh "outputs/test-ci.log" + + - name: Capture Test Prints + run: | + ./temp-ci/give_runs_log.sh "outputs/test-prints.log" + + - name: Run command shell after tests + run: | + ./temp-ci/give_runs_log.sh "outputs/custom-shell-after.log" + + - name: Prepare the push to wiki + run: | + ./temp-ci/give_runs_log.sh "outputs/wiki-clone.log" + + - name: Commit to wiki + run: | + ./temp-ci/give_runs_log.sh "outputs/commit-push-wiki.log" + + - name: Wiki report URLs + run: | + ./temp-ci/give_runs_log.sh "outputs/wiki-report-urls.log"