TST: test on GHA (⏰ wait for #238) #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
# run this every Wednesday at 3 am UTC | |
- cron: 0 3 * * 3 | |
env: | |
YT_DATA: $HOME/yt_data | |
YT_ASTRO_GHA: 1 | |
jobs: | |
get_yt_data: | |
# deactivating this temporarily because data isn't actually used | |
#if: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch yt data | |
run: | | |
mkdir -p $YT_DATA | |
pipx run girder-client \ | |
--api-url https://girder.hub.yt/api/v1 \ | |
download 577c09480d7c6b0001ad5be2 enzo_tiny_cosmology | |
- run: ls enzo_tiny_cosmology | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: enzo_tiny_cosmology | |
path: enzo_tiny_cosmology | |
build: | |
name: "py${{ matrix.python-version }} on ${{ matrix.os }}" | |
needs: | |
- get_yt_data | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
#- '3.9' | |
#- '3.10' | |
- '3.11' | |
runs-on: ${{ matrix.os }} | |
concurrency: | |
# auto-cancel any in-progress job *on the same branch* | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.tests-type }}-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.test-runner }} | |
cancel-in-progress: true | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Set up Conda | |
uses: s-weigand/setup-conda@v1 | |
with: | |
update-conda: true | |
conda-channels: conda-forge | |
activate-conda: true | |
python-version: ${{matrix.python-version}} | |
- name: Build | |
run: | | |
conda install rockstar-galaxies yt h5py | |
conda install --file=test_requirements.txt --yes | |
python -m pip install -e . --no-deps | |
- run: python -m pip list | |
- name: Configure yt | |
run: | | |
yt config set --local yt test_data_dir $YT_DATA | |
yt config set --local yt suppress_stream_logging True | |
yt config set --local yt log_level 30 | |
- run: cat yt.toml | |
- uses: actions/download-artifact@v3 | |
with: | |
name: enzo_tiny_cosmology | |
path: ${{env.YT_DATA}}/enzo_tiny_cosmology | |
- run: echo $YT_DATA; ls $YT_DATA; ls $YT_DATA/enzo_tiny_cosmology | |
- run: pytest --color=yes -ra |