Skip to content

Commit 4733d8e

Browse files
committed
Migrate to GitHub actions
1 parent c7ea8e0 commit 4733d8e

File tree

3 files changed

+68
-46
lines changed

3 files changed

+68
-46
lines changed

.github/workflows/tests.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Run tests
2+
3+
on: [push]
4+
5+
jobs:
6+
test-sh:
7+
name: Test files and run coverage
8+
runs-on: ubuntu-latest
9+
services:
10+
mysql:
11+
image: mysql:5.7
12+
env:
13+
MYSQL_ROOT_PASSWORD: testbench
14+
ports:
15+
- "3308:3306"
16+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Cache shunit2
20+
id: cache-shunit2-2_1_7
21+
uses: actions/cache@v1
22+
with:
23+
path: shunit2-2.1.7
24+
key: ${{ runner.os }}-shunit2-2.1.7
25+
- name: Install shunit
26+
if: steps.cache-shunit2-2_1_7.outputs.cache-hit != 'true'
27+
run: |
28+
wget https://github.com/kward/shunit2/archive/v2.1.7.tar.gz -O shunit2-2.1.7.tar.gz && tar zxf shunit2-2.1.7.tar.gz && rm shunit2-2.1.7.tar.gz
29+
chmod +x ./shunit2-2.1.7/shunit2
30+
- name: Cache apt
31+
id: cache-apt
32+
uses: actions/cache@v1
33+
with:
34+
path: /var/cache/apt/
35+
key: ${{ runner.os }}-apt
36+
- name: Install needed packages
37+
run: sudo apt-get install mysql-client libcurl4-openssl-dev libelf-dev libdw-dev cmake -y --no-install-recommends
38+
- name: Cache kcov
39+
id: cache-kcov-37
40+
uses: actions/cache@v1
41+
with:
42+
path: kcov-37
43+
key: ${{ runner.os }}-kcov-37
44+
- name: Install kcov
45+
if: steps.cache-kcov-37.outputs.cache-hit != 'true'
46+
run: |
47+
wget https://github.com/SimonKagstrom/kcov/archive/v37.tar.gz &&
48+
tar xzf v37.tar.gz && cd kcov-37 && mkdir build && cd build &&
49+
cmake -DCMAKE_INSTALL_PREFIX=/usr .. && make &&
50+
sudo make install && cd ../.. &&
51+
kcov --version
52+
- name: Run tests and coverage
53+
env:
54+
TEST_MYSQL_HOST: "127.0.0.1"
55+
TEST_MYSQL_USER: root
56+
TEST_MYSQL_PASS: testbench
57+
TEST_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
58+
run: |
59+
mysql --host ${TEST_MYSQL_HOST} -u${TEST_MYSQL_USER} -p${TEST_MYSQL_PASS} --port ${TEST_MYSQL_PORT} -e "use mysql; delete from user where User != 'root' OR host != '%'; update user set authentication_string=PASSWORD('testbench'), host='%', password_last_changed=FROM_UNIXTIME(1523829600) where User='root'; update user set plugin='mysql_native_password'; delete from user where User = 'sys'; FLUSH PRIVILEGES;"
60+
./tests.sh
61+
kcov --include-pattern=backup.sh,tests.sh --exclude-pattern=coverage coverage ./tests.sh
62+
sleep 2
63+
- name: Send coverage
64+
uses: codecov/codecov-action@v1
65+
with:
66+
token: ${{ secrets.CODECOV_TOKEN }}

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# sql-backup - Backup your MySQL / MariaDB server !
22
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8b72cd7316b745ed838b739cef3ebd38)](https://app.codacy.com/app/williamdes/sql-backup?utm_source=github.com&utm_medium=referral&utm_content=williamdes/sql-backup&utm_campaign=badger)
3-
[![Build Status](https://travis-ci.org/williamdes/sql-backup.svg?branch=master)](https://travis-ci.org/williamdes/sql-backup)
3+
[![Actions Status](https://github.com/williamdes/sql-backup/workflows/Run%20tests/badge.svg)](https://github.com/williamdes/sql-backup/actions)
44
[![codecov](https://codecov.io/gh/williamdes/sql-backup/branch/master/graph/badge.svg)](https://codecov.io/gh/williamdes/sql-backup)
55
[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](http://unlicense.org/)
66
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwilliamdes%2Fsql-backup.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwilliamdes%2Fsql-backup?ref=badge_shield)
7-
7+
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1827/badge)](https://bestpractices.coreinfrastructure.org/projects/1827)
88
Backup your MySQL / MariaDB server ( structure, data, users, grants, views, triggers, routines, events )
99

1010
## Install

0 commit comments

Comments
 (0)