-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: GitHub CI/CD Workflow | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:24.04 | ||
env: | ||
OPENSSL_DIR: /usr/include/openssl | ||
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu | ||
OPENSSL_INCLUDE_DIR: /usr/include/openssl | ||
|
||
steps: | ||
- name: Install dependencies | ||
run: | | ||
apt-get update | ||
apt-get install -y curl git build-essential libssl-dev | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
- name: Install Node.js # required for build-models.sh | ||
run: | | ||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - | ||
apt-get install -y nodejs | ||
- name: Set up JDK 11 # required for build-models.sh | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
- name: Install Funnel | ||
run: | | ||
if [ -d "funnel" ]; then rm -Rf funnel; fi | ||
git clone https://github.com/ohsu-comp-bio/funnel.git | ||
cd funnel && make && make install && cd .. | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Build models | ||
run: | | ||
bash ./build-models.sh | ||
- name: Build | ||
run: | | ||
cargo build --verbose | ||
- name: Run tests | ||
run: | | ||
bash ./run-tests.sh | ||
- name: Lint | ||
run: | | ||
cargo clippy -- -D warnings | ||
- name: Format | ||
run: | | ||
cargo fmt -- ./lib/src/serviceinfo/models/*.rs # workaround to fix autogenerated code formatting | ||
cargo fmt -- ./lib/src/tes/models/*.rs | ||
cargo fmt -- --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Local CI/CD Workflow | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:24.04 | ||
env: | ||
OPENSSL_DIR: /usr/include/openssl | ||
OPENSSL_LIB_DIR: /usr/lib/x86_64-linux-gnu | ||
OPENSSL_INCLUDE_DIR: /usr/include/openssl | ||
|
||
steps: | ||
|
||
- name: Cache Rust dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cargo | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Cache Rust build output | ||
uses: actions/cache@v3 | ||
with: | ||
path: target | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-build- | ||
|
||
- name: Cache Node.js dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: ${{ runner.os }}-node- | ||
|
||
- name: Cache Maven dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-maven- | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
|
||
- name: Cache Funnel dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/funnel/build | ||
key: ${{ runner.os }}-funnel-${{ hashFiles('**/funnel/*') }} | ||
restore-keys: ${{ runner.os }}-funnel- | ||
|
||
- name: Install Rust | ||
run: | | ||
apt-get update | ||
apt-get install -y curl git build-essential libssl-dev | ||
if ! command -v rustup &> /dev/null # might not be installed while executing using `act` | ||
then | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
. $HOME/.cargo/env | ||
fi | ||
rustup update stable | ||
- name: Install Node.js # required for build-models.sh | ||
run: | | ||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - | ||
apt-get install -y nodejs | ||
- name: Set up JDK 11 # required for build-models.sh | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
- name: Install Funnel | ||
run: | | ||
if [ -d "funnel" ]; then rm -Rf funnel; fi | ||
git clone https://github.com/ohsu-comp-bio/funnel.git | ||
cd funnel && make && make install && cd .. | ||
- uses: actions/checkout@v4 # checkout the repository | ||
- name: Build models | ||
run: | | ||
. $HOME/.cargo/env | ||
bash ./build-models.sh | ||
- name: Build | ||
run: | | ||
. $HOME/.cargo/env | ||
cargo build --verbose | ||
- name: Run tests | ||
run: | | ||
. $HOME/.cargo/env | ||
bash ./run-tests.sh | ||
- name: Lint | ||
run: | | ||
. $HOME/.cargo/env | ||
cargo clippy -- -D warnings | ||
- name: Format | ||
run: | | ||
. $HOME/.cargo/env | ||
# rustup install nightly – fails for some reason | ||
# rustup default nightly | ||
cargo fmt -- ./lib/src/serviceinfo/models/*.rs # workaround to fix autogenerated code formatting | ||
cargo fmt -- ./lib/src/tes/models/*.rs | ||
cargo fmt -- --check # --config-path ./rustfmt.toml |