Skip to content

Add a GitHub workflow #1

Add a GitHub workflow

Add a GitHub workflow #1

Workflow file for this run

name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Create Python virtual environment
run: python -m venv .venv
- name: Install Python dependencies
run: |
source .venv/bin/activate
python -m pip install --upgrade pip
pip install synergy-dataset asreview-datatools pytest pytest-benchmark maturin
- name: Package and Install with Maturin
run: |
source .venv/bin/activate
maturin develop --release
- name: Run synergy get
run: |
source .venv/bin/activate
synergy get -d Appenzeller-Herzog_2019 Brouwer_2019 -l -o benches/files
- name: Convert data
run: |
source .venv/bin/activate
asreview data convert ./benches/files/Appenzeller-Herzog_2019.csv ./benches/files/Appenzeller-Herzog_2019.ris
asreview data convert ./benches/files/Brouwer_2019.csv ./benches/files/Brouwer_2019.ris
ls -l ./benches/files
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
- name: Prepare benchmark results file with system info
run: |
echo "============================= Test Session Info ==============================" >> benches/results.txt
echo "System Information:" >> benches/results.txt
echo "Number of Cores: $(nproc)" >> benches/results.txt
echo "============================== Rust Benchmarks ===============================" >> benches/results.txt
- name: Run Rust benchmarks and write results
run: |
cargo bench | tee benches/results.txt
- name: Run Python benchmarks and append results
run: |
source .venv/bin/activate
pip freeze
pytest --benchmark-min-rounds=10 benches/python_bench.py | tee -a benches/results.txt
- name: Commit results to repository
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add benches/results.txt
git commit -m "Update benchmark results"
git push