From e469e313a11e41dfb81040637ee0be4392134b4a Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Mon, 29 Jul 2024 15:25:35 +0530 Subject: [PATCH] Run stardis tests on tardis PRs --- .github/workflows/stardis-tests.yml | 79 +++++++++++++++++++++++++++++ .github/workflows/stardis.yml | 66 ------------------------ 2 files changed, 79 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/stardis-tests.yml delete mode 100644 .github/workflows/stardis.yml diff --git a/.github/workflows/stardis-tests.yml b/.github/workflows/stardis-tests.yml new file mode 100644 index 00000000000..44b5ea4c314 --- /dev/null +++ b/.github/workflows/stardis-tests.yml @@ -0,0 +1,79 @@ +name: Stardis Tests + +on: + push: + branches: + - '*' + + pull_request: + branches: + - '*' + + types: + - opened + - reopened + - synchronize + - labeled + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} + +env: + CACHE_NUMBER: 0 # increase to reset cache manually + +jobs: + build: + strategy: + matrix: + label: [osx-64, linux-64] + include: + - os: ubuntu-latest + label: linux-64 + prefix: /usr/share/miniconda3/envs/stardis + + - os: macos-latest + label: osx-64 + prefix: /Users/runner/miniconda3/envs/stardis + + name: ${{ matrix.label }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + repository: tardis-sn/stardis + + - name: Setup Mambaforge + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: stardis + use-mamba: true + + - name: Cache lockfile + uses: actions/cache@v2 + with: + path: ${{ matrix.prefix }} + key: conda-${{ matrix.label }}-${{ hashFiles(format('conda-{0}.lock', matrix.label)) }}-${{ env.CACHE_NUMBER }} + id: cache-conda + + - name: Update Conda Environment + id: update-env + run: | + mamba update -n stardis --file conda-${{ matrix.label }}.lock + if: steps.cache-conda.outputs.cache-hit != 'true' + + - name: Install TARDIS + id: install-tardis + run: | + pip install git+https://github.com/tardis-sn/tardis.git@${{ github.sha }} + + - name: Install STARDIS + id: install-stardis + run: | + pip install -e .[test] + + - name: Run Stardis tests + run: pytest \ No newline at end of file diff --git a/.github/workflows/stardis.yml b/.github/workflows/stardis.yml deleted file mode 100644 index 45855a298f5..00000000000 --- a/.github/workflows/stardis.yml +++ /dev/null @@ -1,66 +0,0 @@ -# For more information about TARDIS pipelines, please refer to: -# -# https://tardis-sn.github.io/tardis/development/continuous_integration.html - -name: tests - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - - types: - - opened - - reopened - - synchronize - - labeled - -env: - CACHE_NUMBER: 0 # increase to reset cache manually - PYTEST_FLAGS: --tardis-refdata=${{ github.workspace }}/tardis-refdata --tardis-regression-data=${{ github.workspace }}/tardis-regression-data - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - -defaults: - run: - shell: bash -l {0} - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - - -jobs: - build: - if: github.repository_owner == 'tardis-sn' - strategy: - matrix: - label: [osx-arm64, linux-64] - include: - - label: osx-arm64 - os: macos-latest - prefix: /Users/runner/miniconda3/envs/tardis - - - label: linux-64 - os: ubuntu-latest - prefix: /usr/share/miniconda3/envs/tardis - name: ${{ matrix.label }}-Stardis - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - - name: Setup LFS - uses: ./.github/actions/setup_lfs - - - name: Setup environment - uses: ./.github/actions/setup_env - with: - os-label: ${{ matrix.label }} - - - name: Install Stardis package git - run: pip install git+https://github.com/tardis-sn/stardis.git - - - name: Run tests - run: pytest stardis ${{ env.PYTEST_FLAGS }} \ No newline at end of file