diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..de203d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,99 @@ +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 --features compressed-fields --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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dd53b71..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: rust - -cache: cargo - -install: - - rustup component add rustfmt - - rustfmt --version - - cargo install cargo-tarpaulin --version 0.10.2 - -before_script: - - wget https://github.com/Ortham/testing-plugins/archive/1.4.0.tar.gz - - tar -xf 1.4.0.tar.gz - - mv testing-plugins-1.4.0 testing-plugins - -script: - - cargo fmt --all -- --check - - cargo test --all --all-features - # Running cbindgen through tarpaulin fails due to an unexpected "metadata" - # argument when generating the C header file, so skip the ffi-headers feature. - - cargo tarpaulin --all --features compressed-fields --ciserver travis-ci --coveralls $TRAVIS_JOB_ID - # Need to rebuild the FFI wrapper so that its binary is given a filename - # without a hash. - - cargo build --manifest-path ffi/Cargo.toml --features ffi-headers - - mkdir ffi/build - - cd ffi/build - - cmake .. - - make - - make test diff --git a/Cargo.toml b/Cargo.toml index 7a57c6b..d37b428 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ license = "GPL-3.0" edition = "2018" [badges] -travis-ci = { repository = "Ortham/esplugin" } coveralls = { repository = "Ortham/esplugin" } [dependencies] diff --git a/README.md b/README.md index 76a36f9..a0c868a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ esplugin ======= -[![Build status](https://ci.appveyor.com/api/projects/status/ukb7ns50fskawwsh/branch/master?svg=true)](https://ci.appveyor.com/project/Ortham/esplugin/branch/master) -[![Travis Build Status](https://travis-ci.org/Ortham/esplugin.svg?branch=master)](https://travis-ci.org/Ortham/esplugin) +![CI](https://github.com/Ortham/esplugin/workflows/CI/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/Ortham/esplugin/badge.svg?branch=master)](https://coveralls.io/github/Ortham/esplugin?branch=master) -[![dependency status](https://deps.rs/repo/github/Ortham/esplugin/status.svg)](https://deps.rs/repo/github/Ortham/esplugin) [![docs](https://docs.rs/esplugin/badge.svg)](https://docs.rs/crate/esplugin) A free software library for reading Elder Scrolls Plugin (`.esp`), Elder Scrolls Master (`.esm`) and Elder Scrolls Light Master (`.esl`) files. It can currently parse plugins for the following games: diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4ea3974..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,36 +0,0 @@ -os: Visual Studio 2017 - -version: "{build}-{branch}" - -cache: - - C:\Users\appveyor\.cargo - - target - -install: - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init --profile=minimal -yv - - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - - rustc -vV - - cargo -vV - - - rustup component add rustfmt - - rustfmt --version - - - ps: (New-Object Net.WebClient).DownloadFile('https://github.com/Ortham/testing-plugins/archive/1.4.0.zip', "$env:APPVEYOR_BUILD_FOLDER\1.4.0.zip") - - ps: 7z x "$env:APPVEYOR_BUILD_FOLDER\1.4.0.zip" - - mv testing-plugins-1.4.0 testing-plugins - -build: false - -test_script: - - cargo fmt --all -- --check - - cargo test --all --all-features - - # Need to rebuild the FFI wrapper so that its binary is given a filename - # without a hash. - - cargo build --manifest-path ffi/Cargo.toml --features ffi-headers - - ps: mkdir ffi/build - - cd ffi/build - - cmake .. -G "Visual Studio 15 2017" - - cmake --build . - - ctest