Skip to content

Commit 86e2955

Browse files
committed
cmake + Github Actions
Deprecating autotools and Travis CI.
1 parent a378a00 commit 86e2955

32 files changed

+761
-11665
lines changed

.github/workflows/ci-linux.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: ci-linux
2+
3+
on:
4+
push:
5+
paths:
6+
- '**'
7+
- '!COPYING'
8+
- '!COPYING-asm'
9+
- '!INSTALL'
10+
- '!**.md'
11+
- '!.clang*'
12+
- '!.gitignore'
13+
- '!.gitattributes'
14+
- '!.github/workflows/*'
15+
- '.github/workflows/ci-linux.yml'
16+
pull_request:
17+
paths:
18+
- '**'
19+
- '!COPYING'
20+
- '!COPYING-asm'
21+
- '!INSTALL'
22+
- '!**.md'
23+
- '!.clang*'
24+
- '!.gitignore'
25+
- '!.gitattributes'
26+
- '!.github/workflows/*'
27+
- '.github/workflows/ci-linux.yml'
28+
29+
jobs:
30+
ci-linux:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
compiler: [gcc, clang]
35+
generator: [make, ninja]
36+
include:
37+
- compiler: gcc
38+
cc: gcc
39+
cxx: g++
40+
- compiler: clang
41+
cc: clang
42+
cxx: clang++
43+
- generator: make
44+
cmake_generator: "Unix Makefiles"
45+
- generator: ninja
46+
cmake_generator: "Ninja"
47+
steps:
48+
- name: Install dependencies
49+
run: |
50+
sudo apt-fast update
51+
sudo apt-fast install -y libboost-all-dev ninja-build
52+
- name: Checkout code
53+
uses: actions/checkout@master
54+
- name: Configure
55+
env:
56+
OVERRIDE_CC: ${{ matrix.cc }}
57+
OVERRIDE_CXX: ${{ matrix.cxx }}
58+
run: |
59+
cmake -S . -B build -G ${{ matrix.cmake_generator }}
60+
- name: Build
61+
run: |
62+
cmake --build build -j2

.github/workflows/ci-macos.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: ci-macos
2+
3+
on:
4+
push:
5+
paths:
6+
- '**'
7+
- '!COPYING'
8+
- '!COPYING-asm'
9+
- '!INSTALL'
10+
- '!**.md'
11+
- '!.clang*'
12+
- '!.gitignore'
13+
- '!.gitattributes'
14+
- '!.github/workflows/*'
15+
- '.github/workflows/ci-macos.yml'
16+
pull_request:
17+
paths:
18+
- '**'
19+
- '!COPYING'
20+
- '!COPYING-asm'
21+
- '!INSTALL'
22+
- '!**.md'
23+
- '!.clang*'
24+
- '!.gitignore'
25+
- '!.gitattributes'
26+
- '!.github/workflows/*'
27+
- '.github/workflows/ci-macos.yml'
28+
29+
jobs:
30+
ci-macos:
31+
runs-on: macos-latest
32+
strategy:
33+
matrix:
34+
generator: [make, ninja, xcode]
35+
include:
36+
- generator: make
37+
cmake_generator: "Unix Makefiles"
38+
- generator: ninja
39+
cmake_generator: "Ninja"
40+
- generator: xcode
41+
cmake_generator: "Xcode"
42+
steps:
43+
- name: Install dependencies
44+
run: |
45+
brew install boost make ninja
46+
- name: Checkout code
47+
uses: actions/checkout@master
48+
- name: Configure
49+
run: |
50+
cmake -S . -B build -G ${{ matrix.cmake_generator }}
51+
- name: Build
52+
run: |
53+
cmake --build build -j2

.github/workflows/ci-windows.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: ci-windows
2+
3+
on:
4+
push:
5+
paths:
6+
- '**'
7+
- '!COPYING'
8+
- '!COPYING-asm'
9+
- '!INSTALL'
10+
- '!**.md'
11+
- '!.clang*'
12+
- '!.gitignore'
13+
- '!.gitattributes'
14+
- '!.github/workflows/*'
15+
- '.github/workflows/ci-windows.yml'
16+
pull_request:
17+
paths:
18+
- '**'
19+
- '!COPYING'
20+
- '!COPYING-asm'
21+
- '!INSTALL'
22+
- '!**.md'
23+
- '!.clang*'
24+
- '!.gitignore'
25+
- '!.gitattributes'
26+
- '!.github/workflows/*'
27+
- '.github/workflows/ci-windows.yml'
28+
29+
jobs:
30+
ci-windows:
31+
runs-on: windows-latest
32+
strategy:
33+
matrix:
34+
generator: [msys, vs2019]
35+
architecture: [i686, x86_64]
36+
include:
37+
- generator: make
38+
cmake_generator: "Unix Makefiles"
39+
- generator: msys
40+
cmake_generator: "MSYS Makefiles"
41+
- generator: vs2019
42+
cmake_generator: "Visual Studio 16 2019"
43+
- architecture: i686
44+
msystem: MINGW32
45+
arch: i686
46+
- architecture: i686
47+
msystem: MINGW64
48+
arch: x86_64
49+
defaults:
50+
run:
51+
shell: msys2 {0}
52+
steps:
53+
- name: Install dependencies
54+
uses: msys2/setup-msys2@v2
55+
with:
56+
msystem: ${{ matrix.msystem }}
57+
install:
58+
base-devel git
59+
mingw-w64-${{ matrix.arch }}-toolchain mingw-w64-${{ matrix.arch }}-binutils
60+
mingw-w64-${{ matrix.arch }}-ntldd mingw-w64-${{ matrix.arch }}-boost
61+
- name: Checkout code
62+
uses: actions/checkout@master
63+
- name: Configure
64+
run: |
65+
cmake -S . -B build -G ${{ matrix.cmake_generator }}
66+
- name: Build
67+
run: |
68+
cmake --build build -j2

.github/workflows/coverity-scan.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: coverity-scan
2+
3+
on:
4+
schedule:
5+
- cron: "0 00 * * *" # Daily at 00:00 UTC
6+
workflow_dispatch:
7+
8+
env:
9+
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
10+
EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
11+
SHA1: ${{ github.sha }}
12+
FILE: mdcomp-ubuntu-gcc.tgz
13+
PROJ: flamewing/mdcomp
14+
15+
jobs:
16+
coverity-linux:
17+
if: ${{ github.repository_owner == 'flamewing' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Activity check
21+
run: |
22+
DATEUTC=$(curl -sL https://api.github.com/repos/flamewing/mdcomp/commits | jq -r '[.[]][0]' | jq -r '.commit.committer.date')
23+
TIMESTAMP=$(date --utc -d "$DATEUTC" +%s)
24+
DAYS=$(( ($(date --utc +%s) - $TIMESTAMP) / 86400 ))
25+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
26+
echo REPO_ALIVE=true >> $GITHUB_ENV
27+
else
28+
if [ $DAYS -gt 0 ]; then
29+
echo REPO_ALIVE=false >> $GITHUB_ENV
30+
else
31+
echo REPO_ALIVE=true >> $GITHUB_ENV
32+
fi
33+
fi
34+
- name: Install dependencies
35+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
36+
run: |
37+
sudo apt-fast update
38+
sudo apt-fast install -y libboost-all-dev
39+
- name: Download Coverity Build Tool
40+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
41+
run: |
42+
wget -q https://scan.coverity.com/download/Linux --post-data "token=$TOKEN&project=$PROJ" -O /tmp/cov-analysis-linux64.tar.gz
43+
mkdir /tmp/cov-analysis-linux64
44+
tar xzf /tmp/cov-analysis-linux64.tar.gz --strip 1 -C /tmp/cov-analysis-linux64
45+
- name: Checkout code
46+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
47+
uses: actions/checkout@master
48+
- name: Configure
49+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
50+
run: |
51+
cmake -S . -B build -G 'Unix Makefiles'
52+
- name: Build with cov-build
53+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
54+
run: |
55+
export PATH=/tmp/cov-analysis-linux64/bin:$PATH
56+
cov-build --dir cov-int cmake --build build -j2
57+
- name: Submit the result to Coverity Scan
58+
if: ${{ env.REPO_ALIVE == 'true' }} == 'true'
59+
run: |
60+
tar czvf $FILE cov-int
61+
curl \
62+
--form project=$PROJ \
63+
--form token=$TOKEN \
64+
--form email=$EMAIL \
65+
--form file=@$FILE \
66+
--form version=master \
67+
--form description="$SHA1" \
68+
https://scan.coverity.com/builds?project=$PROJ

.github/workflows/released.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: released
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
virustotal:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: VirusTotal Scan
12+
uses: crazy-max/ghaction-virustotal@v2
13+
with:
14+
vt_api_key: ${{ secrets.VT_API_KEY }}
15+
github_token: ${{ github.token }}
16+
update_release_body: true
17+
files: |
18+
.exe$
+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: snapshots-windows
2+
3+
on:
4+
schedule:
5+
- cron: "0 00 * * *" # Daily at 00:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
snapshots-windows:
10+
if: ${{ github.repository_owner == 'flamewing' }}
11+
runs-on: windows-latest
12+
defaults:
13+
run:
14+
shell: msys2 {0}
15+
steps:
16+
- name: Activity check
17+
shell: bash
18+
run: |
19+
DATEUTC=$(curl -sL https://api.github.com/repos/flamewing/mdcomp/commits | jq -r '[.[]][0]' | jq -r '.commit.committer.date')
20+
TIMESTAMP=$(date --utc -d "$DATEUTC" +%s)
21+
DAYS=$(( ($(date --utc +%s) - $TIMESTAMP) / 86400 ))
22+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
23+
echo REPO_ALIVE=true >> $GITHUB_ENV
24+
else
25+
if [ $DAYS -gt 0 ]; then
26+
echo REPO_ALIVE=false >> $GITHUB_ENV
27+
else
28+
echo REPO_ALIVE=true >> $GITHUB_ENV
29+
fi
30+
fi
31+
- name: Install dependencies
32+
if: ${{ env.REPO_ALIVE == 'true' }}
33+
uses: msys2/setup-msys2@v2
34+
with:
35+
msystem: MINGW32
36+
install:
37+
base-devel git p7zip
38+
mingw-w64-i686-toolchain mingw-w64-i686-binutils mingw-w64-i686-ntldd mingw-w64-i686-boost
39+
- name: Checkout code
40+
if: ${{ env.REPO_ALIVE == 'true' }}
41+
uses: actions/checkout@master
42+
with:
43+
path: exult-i686
44+
- name: Configure
45+
run: |
46+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles'
47+
- name: Build
48+
if: ${{ env.REPO_ALIVE == 'true' }}
49+
run: |
50+
cmake --build build -j2
51+
- name: Create package
52+
if: ${{ env.REPO_ALIVE == 'true' }}
53+
run: |
54+
for ff in $(${MSYSTEM_PREFIX}/bin/ntldd -R build/*.exe | tr '\\' '/' | grep -io "$(cygpath -m ${MSYSTEM_PREFIX}).\+\.dll" | sort -u); do
55+
cp $(cygpath -u "$ff") build/
56+
done
57+
echo "GITHUB_REF=v0.2.0.$(date --utc +'%Y%m%d')" >> $GITHUB_ENV
58+
cd build
59+
"/c/Program Files/7-Zip/7z.exe" -tzip a ../mdcomp-${GITHUB_REF}.zip -mx9 -mmt *.{exe,dll}
60+
- name: VirusTotal Scan
61+
if: ${{ env.REPO_ALIVE == 'true' }}
62+
id: scan_files
63+
uses: crazy-max/ghaction-virustotal@v2
64+
with:
65+
vt_api_key: ${{ secrets.VT_API_KEY }}
66+
github_token: ${{ github.token }}
67+
update_release_body: true
68+
files: |
69+
$GITHUB_WORKSPACE/build/mdcomp-${{ env.GITHUB_REF }}.zip
70+
- name: Generate VirusTotal Body
71+
if: ${{ env.REPO_ALIVE == 'true' }}
72+
run: |
73+
echo "Snapshot ${{ env.GITHUB_REF }}" > $GITHUB_WORKSPACE/build/body.txt
74+
echo "" >> $GITHUB_WORKSPACE/build/body.txt
75+
echo "🛡 [VirusTotal GitHub Action](https://github.com/crazy-max/ghaction-virustotal) analysis:" >> $GITHUB_WORKSPACE/build/body.txt
76+
echo "" >> $GITHUB_WORKSPACE/build/body.txt
77+
analysis="${{ steps.scan_files.outputs.analysis }}"
78+
while read -d, -r pair; do
79+
IFS='=' read -r filename analysisURL <<<"$pair"
80+
echo "* [$(basename $filename)]($analysisURL)" >> $GITHUB_WORKSPACE/build/body.txt
81+
done <<<"$analysis,"
82+
- name: Create release
83+
if: ${{ env.REPO_ALIVE == 'true' }}
84+
id: create_release
85+
uses: actions/create-release@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
tag_name: snapshot-${{ env.GITHUB_REF }}
90+
release_name: Snapshot ${{ env.GITHUB_REF }}
91+
body_path: $GITHUB_WORKSPACE/build/body.txt
92+
draft: true
93+
prerelease: false
94+
# Theses pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`.
95+
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
96+
- name: Upload snapshot
97+
if: ${{ env.REPO_ALIVE == 'true' }}
98+
uses: actions/upload-release-asset@v1
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
with:
102+
upload_url: ${{ steps.create_release.outputs.upload_url }}
103+
asset_path: $GITHUB_WORKSPACE/build/mdcomp-${{ env.GITHUB_REF }}.zip
104+
asset_name: mdcomp-${{ env.GITHUB_REF }}.zip
105+
asset_content_type: application/zip
106+
- name: Finish release
107+
if: ${{ env.REPO_ALIVE == 'true' }}
108+
uses: eregon/publish-release@v1
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
with:
112+
release_id: ${{ steps.create_release.outputs.id }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@ test
104104
.cache
105105

106106
.vscode
107+
108+
#### cmake ####
109+
build

0 commit comments

Comments
 (0)