From d4e90c1796828583836c3741687c9f4905f948b4 Mon Sep 17 00:00:00 2001 From: Robin De Schepper Date: Tue, 13 Feb 2024 15:13:15 +0100 Subject: [PATCH] add ci --- .github/workflows/black.yml | 15 +++++++++++++++ .github/workflows/isort.yml | 20 ++++++++++++++++++++ .github/workflows/main.yaml | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/isort.yml create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..b3489f2 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,15 @@ +name: Black + +on: [push, pull_request] + +jobs: + black: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + with: + options: "--check --verbose" + version: "24.1.1" diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml new file mode 100644 index 0000000..6e4ed9e --- /dev/null +++ b/.github/workflows/isort.yml @@ -0,0 +1,20 @@ +name: Run isort +on: + - push + +jobs: + isort: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install apt dependencies + # Install `libopenmpi` for mpi4py + run: | + sudo apt update + sudo apt install openmpi-bin libopenmpi-dev + # Install dependencies for proper 1st/2nd/3rd party import sorting + - run: pip install -e .[parallel] + - uses: isort/isort-action@v1.1.0 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..dd20ee2 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,33 @@ +name: Build and test BSB JSON + +on: [push, pull_request] + +jobs: + build: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v3.5.0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4.3.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install apt dependencies + run: | + sudo apt update + sudo apt install openmpi-bin libopenmpi-dev + + - name: Install dependencies & self + run: | + pip install --upgrade pip + # Install self, with test dependencies + pip install .[test] + - name: Run tests & coverage + run: | + coverage run -p -m unittest discover -v -s ./tests + mpiexec -n 2 coverage run -p -m unittest discover -v -s ./tests \ No newline at end of file