Skip to content

Commit

Permalink
try with action instead
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt committed May 8, 2024
1 parent 79956e5 commit 833c2ba
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 75 deletions.
24 changes: 24 additions & 0 deletions .github/actions/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Setup Python Environment'
description: 'Set up Python and install dependencies'
inputs:
python_version:
description: 'Python version to set up'
required: false
default: "3.8"
extras:
description: 'extra deps: poetry install -E whatever'
required: false
default: ""

runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: Install dependencies
run: |
pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install ${{ inputs.extras }}
78 changes: 39 additions & 39 deletions .github/workflows/_setup.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
---
name: Setup Python and install dependencies

on:
workflow_call:
inputs:
python_version:
type: string
required: false
default: "3.8"
extras:
type: string
required: false
default: ""

jobs:
setup:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-deps.outputs.cache-key }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Set up cache
id: cache-deps
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ inputs.python_version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install ${{ inputs.extras }}
# ---
# name: Setup Python and install dependencies
#
# on:
# workflow_call:
# inputs:
# python_version:
# type: string
# required: false
# default: "3.8"
# extras:
# type: string
# required: false
# default: ""
#
# jobs:
# setup:
# runs-on: ubuntu-latest
# outputs:
# cache-key: ${{ steps.cache-deps.outputs.cache-key }}
# steps:
# - uses: actions/checkout@v4
#
# - uses: actions/setup-python@v5
# with:
# python-version: ${{ inputs.python_version }}
#
# - name: Set up cache
# id: cache-deps
# uses: actions/cache@v3
# with:
# path: ~/.cache/pypoetry
# key: ${{ runner.os }}-python-${{ inputs.python_version }}-${{ hashFiles('**/poetry.lock') }}
#
# - name: Install dependencies
# run: |
# pip install --upgrade pip poetry
# poetry config virtualenvs.create false
# poetry install ${{ inputs.extras }}
76 changes: 40 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
name: Main CI Workflow

on:
pull_request:
branches:
- master

jobs:
setup_and_test:
- uses: ./.github/workflows/_setup.yml
with:
python_version: '3.8'
extras: '-E numpy'

- name: Linting and static code checks
run: poetry run pre-commit run --all-files

# ---
# name: build
# name: Main CI Workflow
#
# on:
# pull_request:
# branches: [master]
# branches:
# - master
#
# jobs:
# setup_and_test:
# uses: ./.github/workflows/_setup.yml
# with:
# python_version: '3.8'
# extras: '-E numpy'
#
# lint:
# needs: setup_and_test
# runs-on: ubuntu-latest
# steps:
# - uses: ./.github/workflows/_setup.yml
# - name: Linting and static code checks
# run: pre-commit run --all-files
#
# build_docs:
# runs-on: ubuntu-latest
# steps:
# - uses: ./.github/workflows/_setup.yml
# - name: Build docs
# run: cd docs && make html SPHINXOPTS="-W --keep-going"
#
# test_core:
# runs-on: ubuntu-latest
# steps:
# - uses: ./.github/workflows/_setup.yml
# - name: Test core
# run: pytest tests/tests_unit -n8 --dist loadscope --maxfail 10 -m 'not dsl' --test-deps-only-core
# run: poetry run pre-commit run --all-files

---
name: build

on:
pull_request:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup.yml
- name: Linting and static code checks
run: pre-commit run --all-files

build_docs:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup.yml
- name: Build docs
run: cd docs && make html SPHINXOPTS="-W --keep-going"

test_core:
runs-on: ubuntu-latest
steps:
- uses: ./.github/actions/setup.yml
- name: Test core
run: pytest tests/tests_unit -n8 --dist loadscope --maxfail 10 -m 'not dsl' --test-deps-only-core

# test_full:
# runs-on: ${{ matrix.os }}
Expand Down

0 comments on commit 833c2ba

Please sign in to comment.