/ .github / workflows / test-integration.yml
test-integration.yml
 1  name: test-integration
 2  
 3  on:
 4    push:
 5      # only pushes to main trigger
 6      branches: [main]
 7    pull_request:
 8      # always triggered
 9  
10  jobs:
11    integration_test:
12      runs-on: ubuntu-latest
13      timeout-minutes: 120 # when icon needs to be rebuild it can take 70 minutes
14      strategy:
15        matrix:
16          python-version: ['3.10', '3.11', '3.12', '3.13']
17          aiida-version: ['stable']
18  
19      permissions:
20        packages: write
21  
22      steps:
23      - name: Check access to GitHub secrets
24        run: echo "Pull request that trigger this workflow need to be on upstream repo to access GitHub secrets."; exit 1
25        # if a pull request is merged from a fork
26        if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork
27  
28      - uses: actions/checkout@v4
29  
30      - name: Set up Spack
31        uses: spack/setup-spack@v2
32        with:
33          buildcache: true
34  
35      - name: Install Python and ICON
36        env:
37          SPACK_OCI_USER: leclairm
38          SPACK_OCI_TOKEN: ${{ secrets.SPACK_OCI_TOKEN }}
39        run: |
40          sudo apt install gcc-11 g++-11 gfortran-11 graphviz graphviz-dev
41          spack -e . add python@${{matrix.python-version}}
42          spack -e . install
43  
44      - name: Push installation to buildcache and update index
45        env:
46          SPACK_OCI_USER: leclairm
47          SPACK_OCI_TOKEN: ${{ secrets.SPACK_OCI_TOKEN }}
48        run: spack -e . buildcache push --base-image ubuntu:latest --update-index local-buildcache
49        if: ${{ !cancelled() }}
50  
51      - name: Install hatch
52        shell: spack-bash {0}
53        run: |
54          spack env activate .
55          pip install --upgrade pip 
56          pip install hatch
57          hatch run verdi presto
58  
59      - name: Run ICON tests
60        shell: spack-bash {0}
61        env:
62          PYTEST_ADDOPTS: "--durations=0"
63        run: |
64          spack env activate .
65          hatch test -m "requires_icon" --parallel tests