Skip to content

Commit

Permalink
ci: add workflows (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Nikonorov <[email protected]>
  • Loading branch information
JaeAeich and pavelnikonorov authored Oct 28, 2024
1 parent a9ee309 commit 057b5ea
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 158 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/ci.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Code test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format:
name: Running formating checks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: fmt

- name: Run fmt checks
run: |
cargo fmt -- --check
lint:
name: Running lint checks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy

- name: Run unit tests
run: |
cargo clippy -- -D warnings
spell-check:
name: Running spell check
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.9.0'

- name: Install cspell
run: npm install -g cspell

- name: Spell check
run: cspell "**/*"
...
101 changes: 101 additions & 0 deletions .github/workflows/code_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
name: Code test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
common-steps:
name: common setup steps
runs-on: ubuntu-latest
outputs:
rust-toolchain: ${{ steps.set-toolchain.outputs.version }}
steps:
- name: Stop existing Funnel container if running
run: |
docker stop $(docker ps -q --filter ancestor=ohsucompbio/funnel:latest) || true
shell: bash

- name: Start Funnel
run: |
docker run -d -p 8000:8000 ohsucompbio/funnel:latest \
server run --Server.HostName=localhost --Server.HTTPPort=8000
shell: bash

- name: Wait for Funnel to be healthy
run: |
until curl --fail http://localhost:8000/v1/tasks; do
echo "Waiting for Funnel to be healthy..."
sleep 3
done
shell: bash

integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
needs: common-steps
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Run integration tests
run: cargo test --tests

- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin

- name: Run unit tests with coverage
run: cargo tarpaulin --tests --doc --out Xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./tarpaulin-report.xml
flags: test_integration
name: codecov-umbrella
fail_ci_if_error: true
verbose: true

unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: common-steps
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Run unit tests
run: cargo test --lib

- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin

- name: Run unit tests with coverage
run: cargo tarpaulin --tests --doc --out Xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./tarpaulin-report.xml
flags: test_unit
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
...
98 changes: 0 additions & 98 deletions .github/workflows/local.yml

This file was deleted.

Loading

0 comments on commit 057b5ea

Please sign in to comment.