Skip to content

Commit ce0b068

Browse files
Created Github Action Pipeline
1 parent 7fde0eb commit ce0b068

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

.github/workflows/cpp.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Compressor
2+
3+
on: [push]
4+
5+
jobs:
6+
Ubuntu:
7+
name: Build/Test - Ubuntu - GCC ${{ matrix.gcc_version }}
8+
runs-on: ubuntu-latest
9+
env:
10+
CC : gcc-${{ matrix.gcc_version }}
11+
CXX: g++-${{ matrix.gcc_version }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
gcc_version: [7, 8, 9, 10]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: 'recursive'
22+
23+
- name: Build
24+
run: |
25+
mkdir cmake-build
26+
cd ./cmake-build
27+
cmake .. -DCMAKE_BUILD_TYPE=Release
28+
cmake --build . --config Release --clean-first --target Compressor
29+
30+
- name: Download enwik8
31+
run: |
32+
wget -q 'http://mattmahoney.net/dc/enwik8.zip'
33+
unzip enwik8.zip
34+
35+
- name: Run on enwik8
36+
run: |
37+
time ./cmake-build/Compressor -c enwik8 enwik8.compressed
38+
time ./cmake-build/Compressor -d enwik8.compressed enwik8.decompressed
39+
40+
- name: Test Integrity
41+
run: |
42+
rm enwik8
43+
unzip enwik8.zip
44+
ORIGINAL_ENWIK8_SHA512=`sha512sum enwik8`
45+
echo "original enwik8 sha512 hash: $ORIGINAL_ENWIK8_SHA512"
46+
mv enwik8.decompressed enwik8
47+
echo "Decompressed enwik8 sha512 hash:" `sha512sum enwik8`
48+
echo "$ORIGINAL_ENWIK8_SHA512" | sha512sum --check
49+
50+
- name: Upload Binary
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: Compressor_Ubuntu_GCC_${{ matrix.gcc_version }}
54+
path: ./cmake-build/Compressor
55+
56+
57+
########################################################################################
58+
59+
Windows:
60+
name: Build/Test - Windows - ${{ matrix.name }}
61+
runs-on: ${{ matrix.os }}
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
include:
66+
- cmake_generator: CodeBlocks - MinGW Makefiles
67+
cmake_platform_args: " "
68+
name: Mingw-w64 GCC 8
69+
os: windows-latest
70+
- cmake_generator: Visual Studio 15 2017
71+
cmake_platform_args: -A x64
72+
name: Visual Studio 2017
73+
os: windows-2016
74+
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v2
78+
with:
79+
submodules: 'recursive'
80+
81+
- name: Build
82+
run: |
83+
mkdir cmake-build
84+
cd ./cmake-build
85+
cmake .. -DCMAKE_BUILD_TYPE=Release -G "${{ matrix.cmake_generator }}" ${{ matrix.cmake_platform_args }}
86+
cmake --build . --config Release --clean-first --target Compressor
87+
88+
- name: Download enwik8
89+
shell: powershell
90+
run: |
91+
curl.exe -o enwik8.zip --url 'http://mattmahoney.net/dc/enwik8.zip'
92+
Expand-Archive -LiteralPath enwik8.zip -DestinationPath .
93+
94+
- name: Run on enwik8
95+
shell: bash
96+
run: |
97+
# Visual Studio and Mingw save the executable in different paths
98+
exe_path=`find ./cmake-build/ -type f -iname "Compressor.exe" 2>/dev/null`
99+
export PATH="`dirname $exe_path`":$PATH
100+
101+
time Compressor.exe -c enwik8 enwik8.compressed
102+
time Compressor.exe -d enwik8.compressed enwik8.decompressed
103+
104+
- name: Test Integrity
105+
shell: bash
106+
run: |
107+
rm enwik8
108+
unzip enwik8.zip
109+
ORIGINAL_ENWIK8_SHA512=`sha512sum enwik8`
110+
echo "original enwik8 sha512 hash: $ORIGINAL_ENWIK8_SHA512"
111+
mv enwik8.decompressed enwik8
112+
echo "Decompressed enwik8 sha512 hash:" `sha512sum enwik8`
113+
echo "$ORIGINAL_ENWIK8_SHA512" | sha512sum --check
114+
115+
- name: Upload Binary
116+
uses: actions/upload-artifact@v2
117+
with:
118+
name: Compressor_Windows ${{ matrix.name }}
119+
path: |
120+
# Path varies from Visual Studio to MinGW
121+
./cmake-build/Compressor.exe
122+
./cmake-build/*/Compressor.exe

0 commit comments

Comments
 (0)