diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..34cccfe --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,107 @@ +name: CI + Deploy + +on: + push: + branches: + - master + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + uv pip install --system ruff + + - name: Run Ruff + run: | + uv venv .venv + source .venv/bin/activate + uv run ruff check + uv run ruff format --check + + test: + runs-on: ubuntu-latest + needs: lint + steps: + - uses: actions/checkout@v3 + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Run Tests + run: | + uv venv .venv + source .venv/bin/activate + uv run pytest -v --cov=. --cov-report=xml + + - name: Upload to Codecov + run: bash <(curl -s https://codecov.io/bash) + + deploy_to_pypi: + runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v3 + + - name: Install uv + build tools + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + uv pip install --system build twine + + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + uv venv .venv + source .venv/bin/activate + uv run python -m build + uv run python -m twine upload dist/* + + deploy_to_dockerhub: + runs-on: ubuntu-latest + needs: [deploy_to_pypi] + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v3 + + - name: Log in to DockerHub + run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push to DockerHub + run: | + docker buildx build --push \ + --tag rogsme/subscleaner:latest \ + . + + deploy_to_gitea: + runs-on: ubuntu-latest + needs: [deploy_to_pypi] + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v3 + + - name: Log in to Gitea Registry + run: echo "${{ vars.REPOSITORY_TOKEN }}" | docker login git.rogs.me -u rogs --password-stdin + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push to Gitea + run: | + docker buildx build --push \ + --tag git.rogs.me/rogs/subscleaner:latest \ + . diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f628e5e..77429a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,51 +18,13 @@ lint: test: stage: test script: - - uv run pytest -v --cov=. --cov-report=xml - after_script: - - bash <(curl -s https://codecov.io/bash) + - uv run pytest artifacts: reports: coverage_report: coverage_format: cobertura path: coverage.xml -deploy_to_pypi: - stage: deploy - only: - refs: - - master - changes: - - pyproject.toml - except: - - tags - script: - - uv add build twine - - uv run python -m build - - TWINE_USERNAME=__token__ TWINE_PASSWORD=$PYPI_PASSWORD uv run python -m twine upload dist/* - -deploy_to_dockerhub: - stage: deploy - needs: - - job: deploy_to_pypi - optional: true - only: - refs: - - master - changes: - - pyproject.toml - - Dockerfile - except: - - tags - image: docker:latest - services: - - docker:dind - before_script: - - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD - - docker buildx create --use - script: - - docker buildx build --push --tag rogsme/subscleaner:latest . - deploy_to_gitlab: stage: deploy needs: