Przeglądaj źródła

began with simple ci

Rodja Trappe 3 lat temu
rodzic
commit
823b0b9530
2 zmienionych plików z 84 dodań i 0 usunięć
  1. 49 0
      .github/workflows/test.yml
  2. 35 0
      test_startup.sh

+ 49 - 0
.github/workflows/test.yml

@@ -0,0 +1,49 @@
+name: Run Tests
+
+on: [push]
+
+jobs:
+  test:
+    strategy:
+      matrix:
+        python: [3.6, 3.7, 3.8, 3.9]
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    steps:
+      - uses: actions/checkout@v2
+      - name: set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python }}
+      - name: set up Poetry
+        uses: abatilo/actions-poetry@v2.0.0
+        with:
+          poetry-version: "1.1.6"
+      - name: install dependencies
+        run: |
+          pip3 install setuptools==57.4.0 # to fix https://github.com/elimintz/justpy/issues/301
+          poetry config virtualenvs.create false --local
+          poetry install
+      - name: starting
+        run: ./test_startup.sh
+
+  slack:
+    needs:
+      - test
+    if: always() # also execute when test fails
+    runs-on: ubuntu-latest
+    steps:
+      - name: Determine if we need to notify
+        uses: Jimdo/should-i-notify-action@main
+        id: should_notify
+        with:
+          needs_context: ${{ toJson(needs) }}
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+      - name: Slack workflow notification
+        if: steps.should_notify.outputs.should_send_message == 'yes'
+        uses: Gamesight/slack-workflow-status@master
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          slack_webhook_url: ${{ secrets.SLACK_ROBOTICS_CI_WEBHOOK }}
+          channel: "robotik-ci"
+          name: "NiceGUI"

+ 35 - 0
test_startup.sh

@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+run() {
+    output=`{ timeout 2 python3 $1; } 2>&1`
+    exitcode=$?
+    test $exitcode -eq 124 && exitcode=0 # exitcode 124 is comming from "timeout command above"
+    echo $output | grep "JustPy ready to go" > /dev/null || exitcode=1
+    echo $output | grep "Traceback" > /dev/null && exitcode=1
+    echo $output | grep "Error" > /dev/null && exitcode=1
+    if test $exitcode -ne 0; then
+        echo $output
+        return 1
+    fi
+}
+
+check() {
+    echo checking $1 ----------
+    pushd $(dirname "$1") >/dev/null
+    if run $(basename "$1"); then
+        echo "ok --------"
+        popd > /dev/null
+    else
+        echo "failed -------"
+        popd > /dev/null
+        return 1
+    fi
+}
+
+exitcode=0
+pushd ../
+check main.py || exitcode=1
+check examples.py || exitcode=1
+popd
+echo exit $exitcode
+test $exitcode -eq 0