-
Notifications
You must be signed in to change notification settings - Fork 255
146 lines (134 loc) · 4.16 KB
/
starter-saas.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: "[starters/saas:ci]"
on:
push:
branches:
- master
paths:
- starters/saas/**
pull_request:
paths:
- starters/saas/**
env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal
jobs:
style:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
working-directory: ./starters/saas
- name: Run cargo clippy
run: cargo clippy -- -W clippy::nursery -W clippy::pedantic -W rust-2018-idioms -W rust-2021-compatibility
working-directory: ./starters/saas
test:
needs: [style]
runs-on: ubuntu-latest
strategy:
matrix:
db:
- "postgres://postgres:postgres@localhost:5432/postgres_test"
- "sqlite://loco_app.sqlite?mode=rwc"
permissions:
contents: read
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
postgres:
image: postgres
env:
POSTGRES_DB: postgres_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
# Set health checks to wait until postgres has started
options: --health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install seaorm cli
run: cargo install sea-orm-cli
- name: Run cargo test
run: cargo loco db reset && cargo loco db entities && cargo test --all-features --all
working-directory: ./starters/saas
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: ${{matrix.db}}
# generate_template:
# name: Generate Template
# needs: [test]
# runs-on: ubuntu-latest
# permissions:
# contents: read
# services:
# redis:
# image: redis
# options: >-
# --health-cmd "redis-cli ping"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - "6379:6379"
# postgres:
# image: postgres
# env:
# POSTGRES_DB: postgres_test
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# ports:
# - "5432:5432"
# # Set health checks to wait until postgres has started
# options: --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
#
# steps:
# - name: Checkout the code
# uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# toolchain: ${{ env.RUST_TOOLCHAIN }}
# - name: Setup Rust cache
# uses: Swatinem/rust-cache@v2
# - name: Inject slug/short variables
# uses: rlespinasse/[email protected]
# - name: Generate template
# run: |
# cargo build --release --features github_ci
# RUST_LOG=debug LOCO_CURRENT_REPOSITORY=${{ github.event.pull_request.head.repo.html_url }} LOCO_CI_MODE=true LOCO_APP_NAME=saas_starter LOCO_TEMPLATE=saas LOCO_BRANCH=${{ env.GITHUB_HEAD_REF_SLUG }} ./target/release/loco new
# cd saas_starter
# echo "Building generate template..."
# cargo build --release
# echo "Run cargo test on generated template..."
# cargo test
# working-directory: ./loco-cli
# env:
# APP_REDIS_URI: redis://localhost:${{job.services.redis.ports[6379]}}
# APP_DATABASE_URI: postgres://postgres:postgres@localhost:5432/postgres_test