From 58d2f8f60a355c085c185775147819fcdbb668be Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 20 Dec 2023 10:15:06 +0100 Subject: [PATCH] move test-install as a workflow_call --- .github/workflows/ci-code.yml | 2 +- .github/workflows/ci-install.yml | 43 +++++++++++++++++ .github/workflows/test-install.yml | 76 +++++++++++------------------- 3 files changed, 72 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/ci-install.yml diff --git a/.github/workflows/ci-code.yml b/.github/workflows/ci-code.yml index 4539956e86..791d4165d4 100644 --- a/.github/workflows/ci-code.yml +++ b/.github/workflows/ci-code.yml @@ -47,7 +47,7 @@ jobs: tests: - needs: [check-requirements] + #needs: [check-requirements] runs-on: ubuntu-latest timeout-minutes: 45 diff --git a/.github/workflows/ci-install.yml b/.github/workflows/ci-install.yml new file mode 100644 index 0000000000..1617f6e5d8 --- /dev/null +++ b/.github/workflows/ci-install.yml @@ -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 }} + diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index a4e3c30de7..05d987bcf0 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -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 @@ -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 }} @@ -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 @@ -104,7 +86,6 @@ jobs: install-with-pip: - if: github.repository == 'aiidateam/aiida-core' runs-on: ubuntu-latest timeout-minutes: 15 @@ -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 @@ -136,7 +117,6 @@ 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 @@ -144,7 +124,7 @@ jobs: 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. @@ -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 @@ -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: @@ -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 @@ -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