|
| 1 | +name: Build and test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "**" |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - "main" |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre_job: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 17 | + steps: |
| 18 | + - id: skip_check |
| 19 | + uses: fkirc/skip-duplicate-actions@v5 |
| 20 | + with: |
| 21 | + concurrent_skipping: 'same_content_newer' |
| 22 | + build: |
| 23 | + needs: pre_job |
| 24 | + if: needs.pre_job.outputs.should_skip != 'true' |
| 25 | + name: build (${{ matrix.python-version }}, ${{ matrix.platform.name }}) |
| 26 | + runs-on: ${{ matrix.platform.os }} |
| 27 | + strategy: |
| 28 | + max-parallel: 9 |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + python-version: ["3.11"] |
| 32 | + platform: |
| 33 | + #- { name: "windows", os: "windows-latest", shell: "pwsh" } |
| 34 | + - { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" } |
| 35 | + - { name: "macos", os: "macos-latest", shell: "bash -l {0}" } |
| 36 | + defaults: |
| 37 | + run: |
| 38 | + shell: ${{ matrix.platform.shell }} |
| 39 | + steps: |
| 40 | +# |
| 41 | + - name: Checkout the repository (commit) |
| 42 | + uses: actions/checkout@v4 |
| 43 | + if: github.event_name != 'pull_request' |
| 44 | +# |
| 45 | + - name: Checkout the repository (PR) |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + ref: ${{ github.event.pull_request.head.sha }} |
| 49 | + if: github.event_name == 'pull_request' |
| 50 | +# |
| 51 | + - uses: conda-incubator/setup-miniconda@v3 |
| 52 | + with: |
| 53 | + auto-update-conda: true |
| 54 | + python-version: ${{ matrix.python-version }} |
| 55 | + activate-environment: somd2 |
| 56 | + environment-file: environment.yaml |
| 57 | + miniforge-version: latest |
| 58 | + run-post: ${{ matrix.platform.name != 'windows' }} |
| 59 | +# |
| 60 | + - name: Install pytest |
| 61 | + run: conda install pytest |
| 62 | +# |
| 63 | + - name: Install the package |
| 64 | + run: pip install . |
| 65 | +# |
| 66 | + - name: Run the tests |
| 67 | + run: python -m pytest -svvv --color=yes tests |
0 commit comments