Skip to content

Commit

Permalink
First draft on workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander-Karlsson committed Apr 23, 2024
1 parent c83b3a2 commit 23e34f3
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lint code

on:
workflow_call:


jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
env:
PYTHONPATH: ${{ github.workspace }}/install/lib/python${{ matrix.python-version }}/site-packages:${{ github.workspace }}/install/lib/python${{ matrix.python-version }}/dist-packages

steps:
- name: Checkout commit locally
uses: actions/checkout@v3

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

- name: Install subscript-internal with dependencies
run: |
pip install --upgrade pip
pip install ".[tests,docs,ert]"
- name: List all installed packages
run: pip freeze

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: |
SKIP="no-commit-to-branch" pre-commit run --all-files
47 changes: 47 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test & Lint

on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
# Run CI every night and check that tests are working with the latest dependencies.
- cron: '0 0 * * *'

jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
env:
PYTHONPATH: ${{ github.workspace }}/install/lib/python${{ matrix.python-version }}/site-packages:${{ github.workspace }}/install/lib/python${{ matrix.python-version }}/dist-packages

steps:
- name: Checkout commit locally
uses: actions/checkout@v3

- name: Checkout tags
# Necessary for setuptools_scm to be able to infer the correct version.
run: git fetch --unshallow --tags

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

- name: Install subscript-internal with dependencies
run: |
pip install --upgrade pip
pip install ".[tests,docs,ert]"
- name: Run tests
run: |
python -c "import completor"
pytest tests/

0 comments on commit 23e34f3

Please sign in to comment.