Skip to content

Commit

Permalink
move test-install as a workflow_call
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 20, 2023
1 parent bfdb282 commit 58d2f8f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
tests:

needs: [check-requirements]
#needs: [check-requirements]

runs-on: ubuntu-latest
timeout-minutes: 45
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/ci-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: test-install

on:
push:
paths:
- 'environment.yml'
- '**/requirements*.txt'
- 'pyproject.toml'
- 'util/dependency_management.py'
- '.github/workflows/test-install.yml'
- '.github/workflows/ci-code.yml'
branches-ignore: [gh-pages]
pull_request:
paths:
- 'environment.yml'
- '**/requirements*.txt'
- 'pyproject.toml'
- 'util/dependency_management.py'
- '.github/workflows/test-install.yml'
branches-ignore: [gh-pages]
schedule:
- cron: '30 02 * * *' # nightly build

# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# if: github.repository == 'aiidateam/aiida-core'


test-install:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

uses: ./.github/workflows/test-install.yml
with:
python-version: ${{ matrix.python-version }}

76 changes: 28 additions & 48 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
name: test-install

on:
pull_request:
paths:
- 'environment.yml'
- '**/requirements*.txt'
- 'pyproject.toml'
- 'util/dependency_management.py'
- '.github/workflows/test-install.yml'
branches-ignore: [gh-pages]
schedule:
- cron: '30 02 * * *' # nightly build

# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
workflow_call:
inputs:
python-version:
description: Python version
required: true
type: string

jobs:

validate-dependency-specification:
# Note: The specification is also validated by the pre-commit hook.

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '${{ inputs.python-version }}'

- name: Install utils/ dependencies
run: pip install -r utils/requirements.txt
Expand All @@ -51,20 +40,14 @@ jobs:
# https://github.com/pypa/pip/issues/7819

needs: [validate-dependency-specification]
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 5

strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

Expand All @@ -77,22 +60,21 @@ jobs:
- name: Create environment from requirements file.
run: |
pip install -r requirements/requirements-py-${{ matrix.python-version }}.txt
pip install -r requirements/requirements-py-${{ inputs.python-version }}.txt
pip freeze
create-conda-environment:
# Verify that we can create a valid conda environment from the environment.yml file.

needs: [validate-dependency-specification]
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge

Expand All @@ -104,7 +86,6 @@ jobs:
install-with-pip:

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 15

Expand All @@ -114,12 +95,12 @@ jobs:
extras: [ '', '[atomic_tools,docs,notebook,rest,tests,tui]' ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '${{ inputs.python-version }}'

- name: Pip install
id: pip_install
Expand All @@ -136,15 +117,14 @@ jobs:
install-with-conda:
# Verify that we can install AiiDA with conda.

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 25

strategy:
fail-fast: false
matrix:

python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: '${{ inputs.python-version }}'

# Not being able to install with conda on a specific Python version is
# not sufficient to fail the run, but something we want to be aware of.
Expand All @@ -157,10 +137,10 @@ jobs:
optional: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge

Expand Down Expand Up @@ -195,7 +175,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: '${{ inputs.python-version }}'

services:
postgres:
Expand All @@ -222,12 +202,12 @@ jobs:
- 5001:22

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '${{ inputs.python-version }}'

- name: Install system dependencies
run: sudo apt update && sudo apt install postgresql graphviz
Expand Down Expand Up @@ -280,7 +260,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v2
Expand Down

0 comments on commit 58d2f8f

Please sign in to comment.