diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..4077495 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,35 @@ +name: Desktop CI + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: https://git.daemonlord.ru/actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: https://git.daemonlord.ru/actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Validate syntax + run: | + python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py + + - name: Run tests + run: | + python -m unittest tests/test_auth_relogin_smoke.py diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..1c34f2c --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,99 @@ +name: Desktop Release + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + release: + runs-on: windows-latest + + steps: + - name: Checkout + uses: https://git.daemonlord.ru/actions/checkout@v4 + with: + fetch-depth: 0 + tags: true + + - name: Set up Python + uses: https://git.daemonlord.ru/actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt pyinstaller + + - name: Extract app version + id: extract_version + shell: bash + run: | + VERSION=$(python -c "from app_version import APP_VERSION; print(APP_VERSION)") + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Detected version: $VERSION" + + - name: Stop if version already released + id: stop + shell: bash + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + if git show-ref --tags --quiet --verify "refs/tags/$VERSION"; then + echo "Version $VERSION already released, stopping job." + echo "CONTINUE=false" >> "$GITHUB_ENV" + else + echo "Version $VERSION not released yet, continuing workflow..." + echo "CONTINUE=true" >> "$GITHUB_ENV" + fi + + - name: Run tests + if: env.CONTINUE == 'true' + shell: bash + run: | + python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py + python -m unittest tests/test_auth_relogin_smoke.py + + - name: Build release zip + if: env.CONTINUE == 'true' + shell: bash + run: | + python build.py + + - name: Ensure archive exists + if: env.CONTINUE == 'true' + shell: bash + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + test -f "dist/AnabasisManager-$VERSION.zip" + + - name: Configure git identity + if: env.CONTINUE == 'true' + shell: bash + run: | + git config user.name "gitea-actions" + git config user.email "gitea-actions@daemonlord.ru" + + - name: Create git tag + if: env.CONTINUE == 'true' + shell: bash + run: | + VERSION="${{ steps.extract_version.outputs.version }}" + git tag "$VERSION" + git push origin "$VERSION" + + - name: Create Gitea Release + if: env.CONTINUE == 'true' + uses: https://git.daemonlord.ru/actions/gitea-release-action@v1 + with: + server_url: https://git.daemonlord.ru + repository: ${{ gitea.repository }} + token: ${{ secrets.API_TOKEN }} + tag_name: ${{ steps.extract_version.outputs.version }} + name: Release ${{ steps.extract_version.outputs.version }} + body: | + Desktop release ${{ steps.extract_version.outputs.version }} + files: | + dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip diff --git a/.gitignore b/.gitignore index 21f2311..e60bc9f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ __pycache__/ tests/__pycache__/ build/ dist/ +AnabasisManager.spec