diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index a908de3c6..8cb72a8e0 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -15,21 +15,63 @@ jobs: matrix: os: ["ubuntu-latest"] python: ["3.7", "3.8", "3.9", "3.10", "3.11"] - branch: ["master"] + branch: ["master", "release"] runs-on: ${{ matrix.os }} steps: + - name: โฌ‡ Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: src + - name: ๐Ÿ Set up Python ${{ matrix.python }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - - name: โฌ‡ Checkout code + + # Checkout code and install + - name: โฌ‡ Checkout code to test + if: ${{ matrix.branch != 'release' }} uses: actions/checkout@v4 with: ref: ${{ matrix.branch }} fetch-depth: 0 + path: checkout - name: ๐Ÿ‘ท Build and install checkout + if: ${{ matrix.branch != 'release' }} + working-directory: checkout run: | pip install . + + # Install latest release + - name: ๐Ÿ‘€ Determine latest release + if: ${{ matrix.branch == 'release' }} + run: | + OCTOPRINT_VERSION=$(curl -i https://github.com/OctoPrint/OctoPrint/releases/latest | grep -i location: | head -n1 | awk -F/ '{print $NF}' | tr -d '\r') + echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV + - name: ๐Ÿ‘ท Build and install latest release + if: ${{ matrix.branch == 'release' }} + run: | + pip install https://github.com/OctoPrint/OctoPrint/archive/${{ env.OCTOPRINT_VERSION }}.zip + + # Test if server starts without error + - name: ๐Ÿ— Create base config for test server + run: | + mkdir e2econfig + cp -r src/.github/fixtures/with_acl/* e2econfig + - name: ๐Ÿงช Start OctoPrint server + run: | + timeout -k 10s 30s octoprint serve --basedir e2econfig & + wait + - name: ๐Ÿ”Ž Check octoprint.log for errors + run: | + log=${{ github.workspace }}/e2econfig/logs/octoprint.log + if grep "\- ERROR \-" $log; then + echo "::error::Errors were logged to octoprint.log" + grep -Pazo '(?m)^\N+\- ERROR \-\N*\n(^\N*?\n)*?(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \- )' $log + exit 1 + fi + - name: ๐Ÿ“ง Discord success notification continue-on-error: true env: @@ -45,38 +87,3 @@ jobs: uses: Ilshidur/action-discord@master with: args: "๐Ÿšซ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed" - - install-latest: - name: Install latest release - strategy: - matrix: - os: ["ubuntu-latest"] - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] - runs-on: ${{ matrix.os }} - steps: - - name: ๐Ÿ‘€ Determine latest release - run: | - OCTOPRINT_VERSION=$(curl -i https://github.com/OctoPrint/OctoPrint/releases/latest | grep -i location: | head -n1 | awk -F/ '{print $NF}' | tr -d '\r') - echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV - - name: ๐Ÿ Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: ๐Ÿ‘ท Build and install latest release - run: | - pip install https://github.com/OctoPrint/OctoPrint/archive/${{ env.OCTOPRINT_VERSION }}.zip - - name: ๐Ÿ“ง Discord success notification - continue-on-error: true - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} - uses: Ilshidur/action-discord@master - with: - args: "โ˜‘๏ธ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ env.OCTOPRINT_VERSION }}` was successful" - - name: ๐Ÿ“ง Discord failure notification - continue-on-error: true - if: failure() - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} - uses: Ilshidur/action-discord@master - with: - args: "๐Ÿšซ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ env.OCTOPRINT_VERSION }}` failed"