-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.56 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: ci
on:
pull_request:
push:
branches:
- master
jobs:
whatsoo:
runs-on: ubuntu-latest
strategy:
matrix:
image: ["mysql:8.0.18"]
services:
mysql:
image: ${{ matrix.image }}
env:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: whatsoo
ports:
# will assign a random free host port
- 3306/tcp
# needed because the container does not provide a healthcheck
options: >-
--health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s
--health-retries 10 -v /data/mysql:/var/lib/mysql
steps:
- uses: actions/checkout@v1
# Rust ------------------------------------------------
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache target/
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Load schema
working-directory: ./
run: |
export CONTAINER_ID=$(docker ps --filter "ancestor=${{ matrix.image }}" --format "{{.ID}}")
docker cp schema.sql $CONTAINER_ID:/schema.sql
docker exec $CONTAINER_ID bash -c "mysql -uroot -p123456 whatsoo < /schema.sql"
- working-directory: ./
run: cargo build
env:
DATABASE_URL: mysql://root:123456@localhost:${{ job.services.mysql.ports[3306] }}/whatsoo