Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions Workflow for Build and Test #717

Merged
merged 20 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
aa2c376
"Add *.profraw files to .gitignore
niStee Feb 24, 2024
df2cc73
Remove redundant import of TryFrom trait
niStee Feb 24, 2024
6a3d727
Add GitHub Actions workflow for Rust build and test
niStee Feb 24, 2024
6f418aa
Update Codecov action and add token for coverage report upload
niStee Feb 24, 2024
5e93ccb
"Fix misuse of --jobs flag in cargo test command"
niStee Feb 24, 2024
7152ac5
"Fix grcov command in GitHub Actions workflow
niStee Feb 24, 2024
1e6b371
Update GitHub Actions workflow for cross-platform compatibility
niStee Feb 24, 2024
995c1ed
Changed workflow trigger event to 'workflow_run' completion of 'Build…
niStee Feb 24, 2024
dd378ef
"Updated GitHub Actions workflow to correctly set environment variabl…
niStee Feb 24, 2024
6dc20c1
Renamed build and test workflow
niStee Feb 24, 2024
01751c9
Update GitHub Actions workflow trigger
niStee Feb 24, 2024
ad6a370
Update workflow_run trigger in code-coverage.yml
niStee Feb 24, 2024
da92f7c
Fix CODECOV_TOKEN in code-coverage.yml workflow
niStee Feb 24, 2024
b4e0c34
Update code-coverage workflow to trigger on pull requests and pushes …
niStee Feb 24, 2024
3be131a
Update .gitignore file to exclude LLVM profiling output
niStee Feb 25, 2024
4c2e509
Add empty line at the end
niStee Feb 25, 2024
6ea5071
Remove unused import in windows.rs
niStee Feb 25, 2024
a879ef8
Update .github/workflows/build-and-test.yml
niStee Feb 25, 2024
1b0e539
Update .github/workflows/build-and-test.yml
niStee Feb 25, 2024
6386305
Remove code coverage workflow
niStee Feb 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and test
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta, nightly]
niStee marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
niStee marked this conversation as resolved.
Show resolved Hide resolved
- name: Install grcov
run: cargo install grcov
niStee marked this conversation as resolved.
Show resolved Hide resolved
- name: Add llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: Build and test
run: |
cargo build --verbose
cargo test --verbose
env:
RUSTFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: "%p-%m.profraw"
- name: Generate lcov.info
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
niStee marked this conversation as resolved.
Show resolved Hide resolved
file: lcov.info

6 changes: 3 additions & 3 deletions .github/workflows/code-coverage.yml
niStee marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Test with Code Coverage

on:
pull_request:
push:
Expand All @@ -7,8 +9,6 @@ on:
env:
CARGO_TERM_COLOR: always

name: Test with Code Coverage

jobs:
test:
name: Test
Expand Down Expand Up @@ -54,6 +54,6 @@ jobs:
uses: codecov/codecov-action@v4
with:
# required for private repositories:
# token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: true
21 changes: 15 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
## Editor
# JetBrains IDEs
.idea/

# Visual Studio
.vs/
.vscode
.idea

## Build
/target
# Visual Studio Code
.vscode/

# Generic build outputs
/build

## Generated by rustfmt
# Specific for some languages like Rust
/target

# LLVM profiling output
*.profraw

# Backup files for any .rs files in the project
**/*.rs.bk
2 changes: 1 addition & 1 deletion src/steps/os/windows.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::convert::TryFrom;
// use std::convert::TryFrom;
use std::path::Path;
niStee marked this conversation as resolved.
Show resolved Hide resolved
use std::{ffi::OsStr, process::Command};

Expand Down
Loading