Skip to content

Commit

Permalink
Improve handling of rust in CI (#1146)
Browse files Browse the repository at this point in the history
* use dtolnay's toolchain actions
* Forcibly set rust version when needed
* Use cargo-install to cache cbindgen
  • Loading branch information
molpopgen authored Mar 31, 2023
1 parent 6190263 commit 15744dc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
matrix:
compiler: [gcc]
python-version: ["3.10"]
rust: [1.62.1]
defaults:
run:
shell: bash
Expand All @@ -30,6 +31,16 @@ jobs:
submodules: true
fetch-depth: 0

- name: Set up rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}

- name: Install cbindgen
uses: baptiste0928/cargo-install@v2
with:
crate: cbindgen
version: "=0.24.3"
# We install the R dependencies first
# Later, Python dependencies will go into the same place.
# Python will silently update dependencies if needed,
Expand Down Expand Up @@ -74,6 +85,14 @@ jobs:
python -m pip install --user --upgrade setuptools wheel
python -m pip install --user --upgrade -r requirements/development.txt
- name: rustc version
run: |
rustc --version
- name: cbindgen version
run: |
cbindgen --version
- name: Build module
run: |
python3 -m pip install -e .
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
matrix:
python: [ 3.8, 3.9, "3.10", "3.11" ]
os: [ macos-latest, ubuntu-latest ]
rust: [1.62.1]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -76,6 +77,32 @@ jobs:
run: |
cp ~/.bash_profile ~/.bashrc
- name: Set rust version
run: |
source ~/.bashrc
conda activate anaconda-client-env
rustup override set ${{ matrix.rust }}
- name: rustc version
run: |
source ~/.bashrc
conda activate anaconda-client-env
rustc --version
which rustc
- name: Install cbindgen
uses: baptiste0928/cargo-install@v2
with:
crate: cbindgen
version: "=0.24.3"

- name: cbindgen version
run: |
source ~/.bashrc
conda activate anaconda-client-env
cbindgen --version
which cbindgen
- name: Build
run: |
source ~/.bashrc
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,26 @@ jobs:
with:
submodules: true

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: false

- name: Install apt dependencies
run: |
sudo apt install --fix-missing -y libgsl-dev cmake autoconf libboost-test-dev libboost-program-options-dev
- name: Install cbindgen
uses: baptiste0928/cargo-install@v2
with:
crate: cbindgen
version: "=0.24.3"

- name: rustc version
run: |
rustc --version
- name: cbindgen version
run: |
cargo install cbindgen@0.24.3
cbindgen --version
- name: Edit PATH
run: |
Expand Down

0 comments on commit 15744dc

Please sign in to comment.