Skip to content

Add macos runner as part of the test matrix strategy #2

Add macos runner as part of the test matrix strategy

Add macos runner as part of the test matrix strategy #2

Workflow file for this run

name: Run unit tests
on: [push, pull_request]
env:
POSTGRES_DB: scancodeio
POSTGRES_USER: scancodeio
POSTGRES_PASSWORD: scancodeio
POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8
jobs:
build:
services:
postgres:
image: postgres:13
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_INITDB_ARGS: ${{ env.POSTGRES_INITDB_ARGS }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
max-parallel: 4
matrix:
os: [ubuntu-24.04, macos-15]
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y universal-ctags gettext
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install postgresql@13
pg_ctl -D /opt/homebrew/var/postgresql@13 start
createdb $POSTGRES_DB
- name: Install Python dependencies
run: make dev envfile
- name: Validate code format
run: make check
- name: Check Django deployment settings
run: make check-deploy
- name: Build the documentation
run: make docs
- name: Run tests
run: .venv/bin/python manage.py test --verbosity=2 --noinput
env:
SCANCODEIO_DB_NAME: ${{ env.POSTGRES_DB }}
SCANCODEIO_DB_USER: ${{ env.POSTGRES_USER }}
SCANCODEIO_DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}