|
1 | | -name: Build and test |
| 1 | +name: Release Main |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | | - push: |
6 | | - branches: |
7 | | - - "**" |
8 | | - pull_request: |
9 | | - branches: |
10 | | - - "main" |
| 5 | + inputs: |
| 6 | + upload_packages: |
| 7 | + required: true |
| 8 | + description: "Upload packages to anaconda?" |
| 9 | + type: boolean |
11 | 10 |
|
12 | 11 | 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 | 12 | build: |
23 | | - needs: pre_job |
24 | | - if: needs.pre_job.outputs.should_skip != 'true' |
25 | 13 | name: build (${{ matrix.python-version }}, ${{ matrix.platform.name }}) |
26 | 14 | runs-on: ${{ matrix.platform.os }} |
27 | 15 | strategy: |
28 | 16 | max-parallel: 9 |
29 | 17 | fail-fast: false |
30 | 18 | matrix: |
31 | | - python-version: ["3.11"] |
| 19 | + python-version: ["3.10", "3.11", "3.12"] |
32 | 20 | platform: |
33 | | - #- { name: "windows", os: "windows-latest", shell: "pwsh" } |
34 | 21 | - { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" } |
35 | 22 | - { name: "macos", os: "macos-latest", shell: "bash -l {0}" } |
| 23 | + exclude: |
| 24 | + - platform: |
| 25 | + { name: "macos", os: "macos-latest", shell: "bash -l {0}" } |
| 26 | + python-version: "3.12" # MacOS can't run 3.12 yet... |
| 27 | + environment: |
| 28 | + name: ghostly-build |
36 | 29 | defaults: |
37 | 30 | run: |
38 | 31 | shell: ${{ matrix.platform.shell }} |
| 32 | + env: |
| 33 | + SIRE_DONT_PHONEHOME: 1 |
| 34 | + SIRE_SILENT_PHONEHOME: 1 |
39 | 35 | 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 | 36 | - uses: conda-incubator/setup-miniconda@v3 |
52 | 37 | with: |
53 | 38 | auto-update-conda: true |
54 | 39 | python-version: ${{ matrix.python-version }} |
55 | | - activate-environment: somd2 |
56 | | - environment-file: environment.yaml |
| 40 | + activate-environment: ghostly_build |
57 | 41 | miniforge-version: latest |
58 | | - run-post: ${{ matrix.platform.name != 'windows' }} |
59 | 42 | # |
60 | | - - name: Install pytest |
61 | | - run: conda install pytest |
| 43 | + - name: Clone the main branch |
| 44 | + run: git clone -b main https://github.com/openbiosim/ghostly |
| 45 | +# |
| 46 | + - name: Setup Conda |
| 47 | + run: conda install -y -c conda-forge boa anaconda-client packaging |
| 48 | +# |
| 49 | + - name: Update Conda recipe |
| 50 | + run: python ${{ github.workspace }}/ghostly/actions/update_recipe.py |
| 51 | +# |
| 52 | + - name: Prepare build location |
| 53 | + run: mkdir ${{ github.workspace }}/build |
62 | 54 | # |
63 | | - - name: Install the package |
64 | | - run: pip install . |
| 55 | + - name: Build Conda package using conda build |
| 56 | + run: conda build -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/ghostly/recipes/ghostly |
65 | 57 | # |
66 | | - - name: Run the tests |
67 | | - run: python -m pytest -svvv --color=yes tests |
| 58 | + - name: Upload Conda package |
| 59 | + run: python ${{ github.workspace }}/ghostly/actions/upload_package.py |
| 60 | + env: |
| 61 | + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |
| 62 | + ANACONDA_LABEL: main |
| 63 | + if: github.event.inputs.upload_packages == 'true' and ${{ matrix.platform.name == 'linux' && matrix.python-version == '3.11' }} |
0 commit comments