|
| 1 | +name: Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + schedule: |
| 10 | + # run this every Wednesday at 3 am UTC |
| 11 | + - cron: 0 3 * * 3 |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + get_yt_data: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Fetch yt data |
| 19 | + run: | |
| 20 | + pipx run girder-client \ |
| 21 | + --api-url https://girder.hub.yt/api/v1 \ |
| 22 | + download 577c09480d7c6b0001ad5be2 enzo_tiny_cosmology |
| 23 | +
|
| 24 | + - run: ls enzo_tiny_cosmology |
| 25 | + |
| 26 | + - uses: actions/upload-artifact@v3 |
| 27 | + with: |
| 28 | + name: enzo_tiny_cosmology |
| 29 | + path: enzo_tiny_cosmology |
| 30 | + |
| 31 | + build: |
| 32 | + name: "py${{ matrix.python-version }} on ${{ matrix.os }}" |
| 33 | + needs: |
| 34 | + - get_yt_data |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + os: |
| 39 | + - ubuntu-latest |
| 40 | + python-version: |
| 41 | + - '3.9' |
| 42 | + - '3.10' |
| 43 | + - '3.11' |
| 44 | + |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + |
| 47 | + concurrency: |
| 48 | + # auto-cancel any in-progress job *on the same branch* |
| 49 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.tests-type }}-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.test-runner }} |
| 50 | + cancel-in-progress: true |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Set up Python |
| 54 | + uses: actions/setup-python@v4 |
| 55 | + with: |
| 56 | + python-version: ${{ matrix.python-version }} |
| 57 | + - name: Checkout repo |
| 58 | + uses: actions/checkout@v3 |
| 59 | + - name: Set up Conda |
| 60 | + uses: s-weigand/setup-conda@v1 |
| 61 | + with: |
| 62 | + update-conda: true |
| 63 | + conda-channels: conda-forge |
| 64 | + activate-conda: true |
| 65 | + python-version: ${{matrix.python-version}} |
| 66 | + |
| 67 | + - name: Build |
| 68 | + run: | |
| 69 | + conda install rockstar-galaxies yt h5py |
| 70 | + conda install --file=requirements/tests.txt --yes |
| 71 | + python -m pip install -e . --no-deps |
| 72 | +
|
| 73 | + - run: python -m pip list |
| 74 | + |
| 75 | + - name: Configure yt |
| 76 | + run: | |
| 77 | + yt config set --local yt test_data_dir $(pwd)/yt_data |
| 78 | + yt config set --local yt suppress_stream_logging True |
| 79 | + yt config set --local yt log_level 30 |
| 80 | +
|
| 81 | + - run: cat yt.toml |
| 82 | + |
| 83 | + - uses: actions/download-artifact@v3 |
| 84 | + with: |
| 85 | + name: enzo_tiny_cosmology |
| 86 | + path: yt_data/enzo_tiny_cosmology |
| 87 | + |
| 88 | + - run: ls yt_data/enzo_tiny_cosmology |
| 89 | + - run: pytest --color=yes -ra |
0 commit comments