diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..879f3aa9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: build + +on: + push: + pull_request: + types: [ opened, reopened, synchronize ] + release: + types: [ published ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Setup Python 3.10 + uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup UV + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - name: Install dependencies + run: uv sync --extra docs + - name: Build documentation + run: | + cd docs + uv run sphinx-build -b html -j auto -a -n -T -W --keep-going . _build/html + dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Setup Python 3.10 + uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup UV + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - name: Install dependencies + run: uv sync + - name: Build distributions + run: uv build \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 5fd5708e..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -# This workflow builds the Sphinx documentation, and in doing so - checks for errors in the documentation. -name: Docs - -on: - push: - pull_request: - types: [opened, reopened] - workflow_dispatch: - -permissions: - contents: read - -jobs: - docs: - name: Test Docs - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Setup Python 3.10 - uses: actions/setup-python@v6 - with: - python-version: "3.10" - cache: "pip" # Cache the pip packages to speed up the workflow - - - name: Install Dependencies and Package - run: | - python -m pip install -U pip setuptools - pip install -U -r requirements.txt - pip install -e .[docs] - - - name: Build Documentation - run: | - cd docs - sphinx-build -b html -j auto -a -n -T -W --keep-going . _build/html diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8567956f..ec7913c4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,17 +10,16 @@ permissions: jobs: ruff: - permissions: - contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Get Ruff Version + - name: Get Ruff version id: ruff-version run: echo "version=$(grep -Po '(?<=ruff==)[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml)" >> $GITHUB_OUTPUT - - - uses: astral-sh/ruff-action@v3 + + - name: Run Ruff linter + uses: astral-sh/ruff-action@v3 with: version: ${{ steps.ruff-version.outputs.version }} pyright: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index 0318d08d..00000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: PyPI Release - -on: - release: - types: [published] - workflow_dispatch: - -permissions: - contents: read - -jobs: - pypi: - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/fortnite-api - permissions: - id-token: write - steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Setup Python 3.10 - uses: actions/setup-python@v6 - with: - python-version: "3.10" - - - name: Install Dependencies - run: python -m pip install -U pip setuptools build - - - name: Build Project - run: python -m build - - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c1a4722c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: release + +on: + release: + types: [ published ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + dist: + if: github.event_name == 'release' + runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/fortnite-api + steps: + - uses: actions/checkout@v5 + - name: Setup Python 3.10 + uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup UV + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + - name: Install dependencies + run: uv sync + - name: Build distributions + run: uv build + - name: Publish distributions + run: uv publish \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80667640..6b544873 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ # This workflow will ensure that the pushed contents to the repo # are not majorly breaking. -name: Pytests +name: test on: push: @@ -14,27 +14,26 @@ permissions: jobs: pytest: - name: Pytest runs-on: ubuntu-latest - + strategy: + fail-fast: false + matrix: + python-version: [ '3.10', '3.x' ] + name: pytest ${{ matrix.python-version }} steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Setup Python 3.10 + - uses: actions/checkout@v5 + - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} cache: "pip" # Cache the pip packages to speed up the workflow - + - name: Set up UV + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true - name: Install Dependencies and Package - run: | - python -m pip install -U pip setuptools - pip install -U -r requirements.txt - pip install -e .[tests] - + run: uv sync --extra tests - name: Run Pytest Checks - shell: bash env: TEST_API_KEY: ${{ secrets.TEST_API_KEY }} - run: python -m pytest --cov=fortnite_api --import-mode=importlib -vs tests/ \ No newline at end of file + run: uv run pytest --cov=fortnite_api --import-mode=importlib -vs tests/ \ No newline at end of file