diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 22b0a85..7eb68a9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,13 +8,6 @@ updates: time: "02:00" open-pull-requests-limit: 10 -- package-ecosystem: npm - directory: "." - schedule: - interval: daily - time: "02:00" - open-pull-requests-limit: 10 - - package-ecosystem: docker directory: "/" schedule: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab69847..30e1d7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,4 @@ -name: ci - +name: CI on: push: @@ -8,41 +7,38 @@ on: pull_request: workflow_dispatch: - jobs: test: runs-on: ubuntu-latest + strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ["py38", "py39", "py310", "py311", "py312"] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Checkout repository + uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo apt-get install -y - pip install --upgrade setuptools tox - pip install .[test] - python -m playwright install-deps - python -m playwright install - - - name: Run Tox - env: - MILAN_CI_TEST: 1 - run: tox -e py + - name: Build Docker image + run: docker build -t app . - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - file: ./coverage.xml + - name: Run pytest inside Docker container + run: | + docker run \ + -v ./:/app \ + -w /app \ + -u root \ + -e MILAN_CI_TEST=1 \ + app:latest \ + tox -e ${{ matrix.python-version }} - name: Upload artifacts to GitHub uses: actions/upload-artifact@v4 with: - name: python-${{ matrix.python-version }}-artifacts + name: ${{ matrix.python-version }}-artifacts path: artifacts + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..33bc0d9 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,40 @@ +name: "Docker: release" + +on: + push: + tags: + - "v*" + +env: + USERNAME: fscherf + IMAGE_NAME: fscherf/milan + +jobs: + docker-release: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ env.USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.IMAGE_NAME }} + tags: type=match,pattern=v(.*),group=1 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != "pull_request" }} + tags: ${{ steps.meta.outputs.tags }},${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 0000000..6bafff3 --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,45 @@ +name: "PyPi: Release" + +on: + push: + tags: + - "v*" + +env: + PROJECT_NAME: milan + +jobs: + pypi-release: + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/${{ env.PROJECT_NAME }} + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install pypa/build + run: python3 -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: python3 -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TOKEN }}