Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 54 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# If you change the name, change the link on the README.md for the badge too
name: Tests

permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

on:
push:
paths:
- sc2/**
- examples/**
- test/**
- docs_generate/**
- .pre-commit-config.yaml
- generate_dicts_from_data_json.py
- generate_id_constants_from_stableid.py
- uv.lock
- pyproject.toml
- README.md
- .github/workflows/ci.yml
branches:
- master
- develop
pull_request:
branches:
- master
- develop
workflow_dispatch: {}

env:
# Docker image version, see https://hub.docker.com/r/burnysc2/python-sc2-docker/tags
Expand All @@ -35,19 +35,21 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ env.LATEST_PYTHON_VERSION }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Install dependencies
run: |
uv sync --frozen --no-cache --no-install-project
uv sync --frozen --no-install-project
uv run pre-commit install

- name: Run pre-commit hooks
Expand All @@ -59,19 +61,21 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ env.LATEST_PYTHON_VERSION }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Install dependencies
run: |
uv sync --frozen --no-cache --no-install-project
uv sync --frozen --no-install-project
uv run pre-commit install

- name: Run generate dicts
Expand All @@ -84,7 +88,7 @@ jobs:
rm -rf sc2/dicts/__pycache__ sc2/dicts_old/__pycache__

- name: Upload generated dicts folder as artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Generated_dicts
path: sc2/dicts
Expand Down Expand Up @@ -112,19 +116,21 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Install dependencies
run: uv sync --frozen --no-cache --no-install-project
run: uv sync --frozen --no-install-project

- name: Run pytest
run: uv run python -m pytest test
Expand Down Expand Up @@ -169,7 +175,7 @@ jobs:

steps:
# Copy data from repository
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Print directories and files
run: sudo apt-get install tree && tree
Expand Down Expand Up @@ -220,7 +226,7 @@ jobs:

steps:
# Copy data from repository
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Print directories and files
run: sudo apt-get install tree && tree
Expand Down Expand Up @@ -249,7 +255,7 @@ jobs:
#
# steps:
# # Copy data from repository
# - uses: actions/checkout@v3
# - uses: actions/checkout@v7
#
# - name: Print directories and files
# run: |
Expand Down Expand Up @@ -281,7 +287,7 @@ jobs:
IMAGE_NAME: burnysc2/python-sc2-docker:local

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Load and build docker image
# Build docker image from Dockerfile using specific python and sc2 version
Expand Down Expand Up @@ -333,7 +339,7 @@ jobs:
echo "Upload htmlcov folder because it was mounted in container, so it will be available in host machine"

- name: Upload htmlcov/ folder as artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Coverage_report
path: htmlcov
Expand All @@ -345,18 +351,20 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ env.LATEST_PYTHON_VERSION }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Install dependencies
run: uv sync --frozen --no-cache --no-install-project
run: uv sync --frozen --no-install-project

- name: Run uv radon
run: uv run radon cc sc2/ -a -nb
Expand All @@ -368,18 +376,20 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ env.LATEST_PYTHON_VERSION }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Install dependencies
run: uv sync --frozen --no-cache --no-install-project
run: uv sync --frozen --no-install-project

- name: Build docs from scratch
run: |
Expand All @@ -393,7 +403,7 @@ jobs:

- name: Publish to Github Pages
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@releases/v4
uses: JamesIves/github-pages-deploy-action@v4
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: develop # The branch the action should deploy from.
Expand All @@ -407,15 +417,17 @@ jobs:
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Set up Python ${{ env.LATEST_PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@v7
with:
python-version: ${{ env.LATEST_PYTHON_VERSION }}

- name: Install uv
run: pip install uv
uses: astral-sh/setup-uv@v10.3.0
with:
enable-cache: true

- name: Remove test folder to not include it in package
run: rm -rf test
Expand Down
36 changes: 21 additions & 15 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Build and push Docker image

# Only run if Dockerfile or docker-ci.yml changed
permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

on:
push:
paths:
- dockerfiles/**
- uv.lock
- pyproject.toml
- .github/workflows/docker-ci.yml
branches:
- master
- develop
pull_request:
branches:
- master
- develop
workflow_dispatch: {}

env:
VERSION_NUMBER: "1.0.7"
Expand All @@ -30,10 +36,10 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Cache sc2 maps
uses: actions/cache@v4
uses: actions/cache@v6
id: cache-sc2-maps
with:
path: |
Expand All @@ -57,10 +63,10 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Cache sc2 maps
uses: actions/cache@v4
uses: actions/cache@v6
id: cache-sc2-maps
with:
path: |
Expand Down Expand Up @@ -91,10 +97,10 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Cache sc2 maps
uses: actions/cache@v4
uses: actions/cache@v6
id: cache-sc2-maps
with:
path: |
Expand Down Expand Up @@ -131,10 +137,10 @@ jobs:
BUILD_ARGS: --build-arg PYTHON_VERSION=${{ matrix.python-version }} --build-arg SC2_VERSION=${{ matrix.sc2-version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v7

- name: Cache sc2 maps
uses: actions/cache@v4
uses: actions/cache@v6
id: cache-sc2-maps
with:
path: |
Expand Down Expand Up @@ -173,7 +179,7 @@ jobs:

- name: Login to DockerHub
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
uses: docker/login-action@v2
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
Loading