diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 6f41f78c..1794fc72 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -10,7 +10,7 @@ jobs: # Builds the code # ------------------------------ build: - name: Build on node ${{matrix.python_version}} + name: Build on node Python ${{matrix.python_version}} outputs: tag: ${{steps.tag.outputs.tag}} runs-on: ubuntu-latest @@ -38,107 +38,107 @@ jobs: echo "Tag: $TAG" echo "::set-output name=tag::$TAG" -# -# # ------------------------------ -# # Turn on ENV -# # ------------------------------ -# turn-on-env: -# name: Turn on test environment -# runs-on: ubuntu-latest -# env: -# TPLINK_USER: ${{ secrets.TPLINK_USER }} -# TPLINK_PASS: ${{ secrets.TPLINK_PASS }} -# steps: -# - name: Setup Node.js environment -# uses: actions/setup-node@v1.4.2 -# with: -# node-version: 11.x -# - uses: actions/checkout@v2 -# - name: Install npm dependencies -# run: | -# pushd ext-res/tests -# npm install -# popd -# - name: Powering on the dev-environment -# run: | -# pushd ext-res/tests -# node ./switch.js --dev MEROSS_LAB --toggle=on -# popd -# -# # --------------------------------- -# # Testing -# # --------------------------------- -# test: -# name: Testing -# runs-on: ubuntu-latest -# needs: [build, turn-on-env] -# steps: -# - uses: actions/checkout@v2 -# - name: Setup Python ${{matrix.python_version}} -# uses: actions/setup-python@v2 -# with: -# python-version: 3.8 -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# pip install pytest -# pip install pytest-html -# pip install pytest-cov -# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi -# - name: Wait a bit before running tests -# run: | -# echo "Waiting 120 seconds before starting..." -# sleep 120 -# echo "Waiting done." -# - name: Test with pytest -# env: -# MEROSS_EMAIL: ${{ secrets.MEROSS_EMAIL }} -# MEROSS_PASSWORD: ${{ secrets.MEROSS_PASSWORD }} -# run: | -# pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html --html=junit/test-results.html --self-contained-html -# - name: Upload pytest test results -# uses: actions/upload-artifact@v2 -# with: -# name: pytest-results -# path: junit/ -# # Use always() to always run this step to publish test results when there are test failures -# if: ${{ always() }} -# -# - name: Upload pytest test results -# uses: actions/upload-artifact@v2 -# with: -# name: pytest-results-html -# path: htmlcov/ -# # Use always() to always run this step to publish test results when there are test failures -# if: ${{ always() }} -# -# # ------------------------------ -# # Turn off ENV -# # ------------------------------ -# turn-off-env: -# name: Turn off test environment -# runs-on: ubuntu-latest -# needs: [test] -# env: -# TPLINK_USER: ${{ secrets.TPLINK_USER }} -# TPLINK_PASS: ${{ secrets.TPLINK_PASS }} -# steps: -# - name: Setup Node.js environment -# uses: actions/setup-node@v1.4.2 -# with: -# node-version: 11.x -# - uses: actions/checkout@v2 -# - name: Install npm dependencies -# run: | -# pushd ext-res/tests -# npm install -# popd -# - name: Powering on the dev-environment -# run: | -# pushd ext-res/tests -# node ./switch.js --dev MEROSS_LAB --toggle=off -# popd -# if: ${{ always() }} + + # ------------------------------ + # Turn on ENV + # ------------------------------ + turn-on-env: + name: Turn on test environment + runs-on: ubuntu-latest + env: + TPLINK_USER: ${{ secrets.TPLINK_USER }} + TPLINK_PASS: ${{ secrets.TPLINK_PASS }} + steps: + - name: Setup Node.js environment + uses: actions/setup-node@v1.4.2 + with: + node-version: 11.x + - uses: actions/checkout@v2 + - name: Install npm dependencies + run: | + pushd ext-res/tests + npm install + popd + - name: Powering on the dev-environment + run: | + pushd ext-res/tests + node ./switch.js --dev MEROSS_LAB --toggle=on + popd + + # --------------------------------- + # Testing + # --------------------------------- + test: + name: Testing + runs-on: ubuntu-latest + needs: [build, turn-on-env] + steps: + - uses: actions/checkout@v2 + - name: Setup Python ${{matrix.python_version}} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install pytest-html + pip install pytest-cov + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Wait a bit before running tests + run: | + echo "Waiting 120 seconds before starting..." + sleep 120 + echo "Waiting done." + - name: Test with pytest + env: + MEROSS_EMAIL: ${{ secrets.MEROSS_EMAIL }} + MEROSS_PASSWORD: ${{ secrets.MEROSS_PASSWORD }} + run: | + pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html --html=junit/test-results.html --self-contained-html + - name: Upload pytest test results + uses: actions/upload-artifact@v2 + with: + name: pytest-results + path: junit/ + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} + + - name: Upload pytest test results + uses: actions/upload-artifact@v2 + with: + name: pytest-results-html + path: htmlcov/ + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} + + # ------------------------------ + # Turn off ENV + # ------------------------------ + turn-off-env: + name: Turn off test environment + runs-on: ubuntu-latest + needs: [test] + env: + TPLINK_USER: ${{ secrets.TPLINK_USER }} + TPLINK_PASS: ${{ secrets.TPLINK_PASS }} + steps: + - name: Setup Node.js environment + uses: actions/setup-node@v1.4.2 + with: + node-version: 11.x + - uses: actions/checkout@v2 + - name: Install npm dependencies + run: | + pushd ext-res/tests + npm install + popd + - name: Powering on the dev-environment + run: | + pushd ext-res/tests + node ./switch.js --dev MEROSS_LAB --toggle=off + popd + if: ${{ always() }} # ------------------------------ # Pre-Release on DEV @@ -146,15 +146,9 @@ jobs: pre-release: name: Pre-Release on GitHub runs-on: ubuntu-latest - needs: [build] + needs: [build, test] steps: - - name: Calculate Version - id: debug - run: | - echo "Workspace." - ls -l $GITHUB_WORKSPACE - echo "Current dir" - ls -l + - uses: actions/checkout@v2 - name: Calculate Version id: tag run: |