-
Notifications
You must be signed in to change notification settings - Fork 139
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 Actions and add test infrastructure with Catch2 #96
Open
nhthn
wants to merge
7
commits into
craigsapp:master
Choose a base branch
from
nhthn:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2a6617b
Add stub for Catch2 tests
nhthn 0e60b86
Add GitHub Actions
nhthn f0fcb94
Remove Travis and AppVeyor
nhthn dbc7c41
Fix missing flags
nhthn 154f572
Update CMake version to 3.0
nhthn f48cf5e
Add first test
nhthn 6b9b063
Add test for reading/writing nonempty MIDI file
nhthn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,52 @@ | ||||||
name: Actions | ||||||
|
||||||
on: | ||||||
push: | ||||||
branches: [master] | ||||||
pull_request: | ||||||
branches: [master] | ||||||
|
||||||
env: | ||||||
BUILD_TYPE: Release | ||||||
|
||||||
jobs: | ||||||
linux: | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- uses: actions/checkout@v2 | ||||||
with: | ||||||
submodules: recursive | ||||||
- name: Install dependencies | ||||||
run: sudo apt-get install cmake g++ | ||||||
- name: Configure CMake | ||||||
run: cmake -S . -B build -DMIDIFILE_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||||||
- name: Build project | ||||||
run: cmake --build build | ||||||
- name: Run tests | ||||||
run: ./build/midifile_test | ||||||
|
||||||
windows: | ||||||
runs-on: windows-2019 | ||||||
steps: | ||||||
- uses: actions/checkout@v2 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
with: | ||||||
submodules: recursive | ||||||
- name: Configure CMake | ||||||
run: cmake -S . -B build -DMIDIFILE_BUILD_TESTS=ON -G "Visual Studio 16 2019" -A x64 | ||||||
- name: Build project | ||||||
run: cmake --build build --config ${{env.BUILD_TYPE}} | ||||||
- name: Run tests | ||||||
run: ./build/${{env.BUILD_TYPE}}/midifile_test.exe | ||||||
|
||||||
macos: | ||||||
runs-on: macos-11 | ||||||
steps: | ||||||
- uses: actions/checkout@v2 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
with: | ||||||
submodules: recursive | ||||||
- name: Configure CMake | ||||||
run: cmake -S . -B build -DMIDIFILE_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||||||
- name: Build project | ||||||
run: cmake --build build | ||||||
- name: Run tests | ||||||
run: ./build/midifile_test |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
.* | ||
!.gitignore | ||
_site | ||
temp | ||
|
@@ -24,3 +22,4 @@ err | |
*.idb | ||
*.ilk | ||
*.opendb | ||
build* |
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,4 @@ | ||
[submodule "Catch2"] | ||
path = external_libraries/Catch2 | ||
url = https://github.com/catchorg/Catch2.git | ||
branch = v2.x |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
#include <sstream> | ||
#include <vector> | ||
#include <tuple> | ||
|
||
#define CATCH_CONFIG_MAIN | ||
#include "catch2/catch.hpp" | ||
|
||
#include "MidiFile.h" | ||
|
||
TEST_CASE("Writing and reading an empty MIDI file works") { | ||
smf::MidiFile midifile1; | ||
REQUIRE(midifile1.size() == 1); | ||
std::stringstream stream; | ||
midifile1.write(stream); | ||
REQUIRE(midifile1.status()); | ||
smf::MidiFile midifile2; | ||
midifile2.read(stream); | ||
REQUIRE(midifile2.size() == 1); | ||
REQUIRE(midifile2.status()); | ||
} | ||
|
||
TEST_CASE("Writing and reading a MIDI file with note on and note off messages works") { | ||
smf::MidiFile midifile1; | ||
|
||
std::vector<uint8_t> noteOnMessage = { 0x90, 0x3c, 0x7F }; | ||
smf::MidiEvent noteOn(0, 1, noteOnMessage); | ||
std::vector<uint8_t> noteOffMessage = { 0x80, 0x3c, 0x7F }; | ||
smf::MidiEvent noteOff(100, 1, noteOffMessage); | ||
std::vector<uint8_t> trackEndMessage = { 0xFF, 0x2F, 0x00 }; | ||
smf::MidiEvent trackEnd(200, 1, trackEndMessage); | ||
midifile1[0].push_back(noteOn); | ||
midifile1[0].push_back(noteOff); | ||
midifile1[0].push_back(trackEnd); | ||
|
||
std::stringstream stream; | ||
midifile1.write(stream); | ||
REQUIRE(midifile1.status()); | ||
smf::MidiFile midifile2; | ||
midifile2.read(stream); | ||
|
||
REQUIRE(midifile1.size() == midifile2.size()); | ||
REQUIRE(midifile1[0].size() == midifile2[0].size()); | ||
for (int i = 0; i < midifile1[0].size(); i++) { | ||
REQUIRE(midifile1[0][i] == midifile2[0][i]); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.