Add initial test suite #532
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CLI Setup | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| test_cli_base_container: | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/qmk/qmk_base_container | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install dependencies | |
| run: apt-get update && apt-get install -y python3-venv | |
| - name: Run unit test | |
| shell: bash | |
| run: | | |
| python3 -m venv .ci_venv | |
| source .ci_venv/bin/activate | |
| python3 -m pip install -r requirements.txt | |
| python3 -m pip install --group dev | |
| pytest | |
| - name: Run ci_tests | |
| run: ./ci_tests | |
| test_cli_linux_macos: | |
| needs: test_cli_base_container | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest] | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Run ci_tests | |
| run: ./ci_tests | |
| test_cli_win: | |
| needs: test_cli_base_container | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: (MSYS2) Setup and install dependencies | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| update: true | |
| install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-build mingw-w64-x86_64-python-pillow mingw-w64-x86_64-rust mingw-w64-x86_64-python-halo mingw-w64-x86_64-python-nh3 mingw-w64-x86_64-python-rpds-py mingw-w64-x86_64-python-ruff | |
| # Upgrade pip due to msys packaging + pypa/build/pull/736 issues | |
| - name: (MSYS2) Install Python dependencies | |
| shell: msys2 {0} | |
| run: | | |
| python3 -m pip install --break-system-packages --force-reinstall --upgrade pip | |
| - name: Run ci_tests | |
| shell: msys2 {0} | |
| run: ./ci_tests | |
| test_docker_container: | |
| needs: test_cli_base_container | |
| runs-on: ubuntu-latest | |
| env: | |
| TEST_TAG: qmkfm/qmk_cli:test | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.9' | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - uses: actions/checkout@v7 | |
| - name: Install dependencies | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| pip install setuptools wheel | |
| pip install --group dev | |
| - name: Build Python | |
| run: | | |
| python3 -m build | |
| - name: Build Test Container | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| load: true | |
| tags: ${{ env.TEST_TAG }} | |
| - name: Test | |
| run: | | |
| docker run --rm -v ${{ github.workspace }}:/qmk_cli -w /qmk_cli ${{ env.TEST_TAG }} /qmk_cli/ci_tests | |
| - name: Build All Containers | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| target: full | |
| platforms: linux/amd64,linux/arm64 |