Skip to content

Commit

Permalink
Migrate CI to GitHub Actions
Browse files Browse the repository at this point in the history
There's nothing wrong with Travis CI, but AppVeyor has started to fail
builds with a toolchain error when they install rustfmt. This isn't the
first time that AppVeyor has broken my builds, so I'm migrating away
from it.

I could have migrated to Travis CI's relatively new Windows support, but
that's still in the early adoption phase according to its own docs, and
I might as well instead move to GitHub's first-party offering. There's
no point then using Travis CI for Linux builds when that can be done on
GitHub Actions too.
  • Loading branch information
Ortham committed Oct 12, 2020
1 parent 6e168bf commit 74eee36
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 78 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Install Rustfmt
run: |
rustup component add rustfmt
rustfmt --version
- name: Check formatting
run: cargo fmt --all -- --check

windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Prepare test resources
run: |
(New-Object Net.WebClient).DownloadFile('https://github.com/WrinklyNinja/testing-plugins/archive/1.4.1.zip', "$PWD/1.4.1.zip")
7z x 1.4.1.zip
mv testing-plugins-1.4.1 testing-plugins
- name: Build and run tests
run: cargo test --all --all-features

# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers

# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest
linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Tarpaulin
run: curl -sL https://github.com/xd009642/tarpaulin/releases/download/0.14.2/cargo-tarpaulin-0.14.2-travis.tar.gz | tar xvz -C $HOME/.cargo/bin

- name: Prepare test resources
run: |
wget https://github.com/WrinklyNinja/testing-plugins/archive/1.4.1.tar.gz
tar -xf 1.4.1.tar.gz
mv testing-plugins-1.4.1 testing-plugins
- name: Build and run tests with code coverage
run: cargo tarpaulin --workspace --out Lcov

- name: Upload code coverage to Coveralls
uses: coverallsapp/github-action@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info

# Need to rebuild the FFI wrapper so that its binary is given a filename
# without a hash.
- name: Build FFI wrapper
run: cargo build --manifest-path ffi/Cargo.toml --features ffi-headers

# Use bash because PowerShell doesn't fail if one command fails.
- name: Build and run C++ tests
shell: bash
run: |
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ exclude = [
]

[badges]
appveyor = { repository = "Ortham/libloadorder" }
travis-ci = { repository = "Ortham/libloadorder" }
coveralls = { repository = "Ortham/libloadorder" }

[dependencies]
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Libloadorder

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Ortham/libloadorder?branch=master&svg=true)](https://ci.appveyor.com/project/Ortham/libloadorder)
[![Travis Build Status](https://travis-ci.org/Ortham/libloadorder.svg?branch=master)](https://travis-ci.org/Ortham/libloadorder)
![CI](https://github.com/Ortham/libloadorder/workflows/CI/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/Ortham/libloadorder/badge.svg?branch=master)](https://coveralls.io/github/Ortham/libloadorder?branch=master)
[![dependency status](https://deps.rs/repo/github/Ortham/libloadorder/status.svg)](https://deps.rs/repo/github/Ortham/libloadorder)
[![docs](https://docs.rs/libloadorder-ffi/badge.svg)](https://docs.rs/crate/libloadorder-ffi)

Libloadorder is a cross-platform library for manipulating the load order and
Expand Down
37 changes: 0 additions & 37 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include_directories("${CMAKE_SOURCE_DIR}/include")

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (SYSTEM_LIBS pthread dl)
set (SYSTEM_LIBS pthread dl m)
endif ()

if (MSVC)
Expand Down

0 comments on commit 74eee36

Please sign in to comment.