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

Migrate to Github CI, test rust package compilation during CI #14

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI
on:
push:
branches:
- master
pull_request:

jobs:
ci:
strategy:
fail-fast: true
matrix:
python-version: [3.8]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Prerequisites
run: ./scripts/install-prereqs.sh
- name: Run tests
run: pytest
- name: Build a Rust package via colcon
run: ./scripts/build-rust-package.sh
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# colcon-cargo

![CI](https://github.com/colcon/colcon-cargo/workflows/ci/badge.svg)

An extension for `colcon-core <https://github.com/colcon/colcon-core>`_ to
support Rust projects built with Cargo.
4 changes: 0 additions & 4 deletions README.rst

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/build-rust-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e

function announce() {
echo "================================================================================"
echo "$@"
echo "================================================================================"
}

# go to the root of the repo
cd $(dirname $(readlink -f $0))/..

# build with colcon and source
announce "Building and sourcing colcon-cargo"
colcon build
source install/setup.sh

# now build a sample rust package
announce "Building and sourcing sample Ruts app"
cd test/rust-sample-package
colcon build
source install/setup.sh

# is the rust package properly installed?
output=$(app 2>&1)
[[ "$output"=="Hello, world!" ]] || {
echo "Didn't get the expected output."
echo "Output: $output"
}
10 changes: 10 additions & 0 deletions scripts/install-prereqs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
pip install --upgrade setuptools \
git+https://github.com/colcon/colcon-core \
git+https://github.com/colcon/colcon-library-path \
pytest pytest-cov \
pyenchant \
flake8-blind-except flake8-builtins flake8-class-newline \
flake8-comprehensions flake8-deprecated flake8-docstrings flake8-quotes \
pep8-naming pylint

9 changes: 9 additions & 0 deletions test/rust-sample-package/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "app"
version = "0.1.0"
authors = ["Nikos Koukis <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
3 changes: 3 additions & 0 deletions test/rust-sample-package/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}