|
| 1 | +name: Implementation Testing |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + |
| 8 | +env: |
| 9 | + CACHE_NUMBER: 0 # increase to reset cache manually |
| 10 | + |
| 11 | +jobs: |
| 12 | + foundation: |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: ["3.10"] |
| 17 | + defaults: |
| 18 | + run: |
| 19 | + shell: bash -l {0} |
| 20 | + name: linux-64-py${{ matrix.python-version }} |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + # checkout the code in this repository |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + path: 'activitysim-prototype-mtc' |
| 27 | + |
| 28 | + # checkout the main branch of ActivitySim itself |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + repository: 'ActivitySim/activitysim' |
| 32 | + ref: main |
| 33 | + path: 'activitysim' |
| 34 | + |
| 35 | + - name: Setup Mambaforge |
| 36 | + uses: conda-incubator/setup-miniconda@v3 |
| 37 | + with: |
| 38 | + miniforge-variant: Mambaforge |
| 39 | + miniforge-version: latest |
| 40 | + activate-environment: asim-test |
| 41 | + use-mamba: true |
| 42 | + python-version: ${{ matrix.python-version }} |
| 43 | + |
| 44 | + - name: Set cache date for year and month |
| 45 | + run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV |
| 46 | + |
| 47 | + - uses: actions/cache@v4 |
| 48 | + with: |
| 49 | + path: /usr/share/miniconda3/envs/asim-test |
| 50 | + key: linux-64-conda-${{ hashFiles('activitysim/conda-environments/github-actions-tests.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} |
| 51 | + id: cache |
| 52 | + |
| 53 | + - name: Update environment |
| 54 | + run: | |
| 55 | + mamba env update -n asim-test -f activitysim/conda-environments/github-actions-tests.yml |
| 56 | + mamba install --yes \ |
| 57 | + "psutil=5.9.5" \ |
| 58 | + "pydantic=2.6.1" \ |
| 59 | + "pypyr=5.8.0" \ |
| 60 | + "pytables=3.6.1" \ |
| 61 | + "pytest-cov" \ |
| 62 | + "pytest-regressions=2.5.0" \ |
| 63 | + "scikit-learn=1.2.2" \ |
| 64 | + "sharrow>=2.6.0" \ |
| 65 | + "simwrapper=1.8.5" \ |
| 66 | + "xarray=2023.2.0" \ |
| 67 | + "zarr=2.14.2" \ |
| 68 | + "zstandard=0.21.0" |
| 69 | + if: steps.cache.outputs.cache-hit != 'true' |
| 70 | + |
| 71 | + - name: Install activitysim |
| 72 | + # installing without dependencies is faster, we trust that all needed dependencies |
| 73 | + # are in the conda environment defined above. Also, this avoids pip getting |
| 74 | + # confused and reinstalling tables (pytables). |
| 75 | + run: | |
| 76 | + python -m pip install -e ./activitysim --no-deps |
| 77 | +
|
| 78 | + - name: Conda checkup |
| 79 | + run: | |
| 80 | + mamba info -a |
| 81 | + mamba list |
| 82 | +
|
| 83 | + - name: Test this implementation |
| 84 | + run: | |
| 85 | + python -m pytest activitysim-prototype-mtc/test |
0 commit comments