mCaptcha/.github/workflows/linux.yml
2021-06-11 20:02:08 +05:30

113 lines
2.9 KiB
YAML

name: Build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- 1.51.0
# - nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mcaptcha-redis:
image: mcaptcha/cache
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
node_modules
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install JavaScript Dependencies
run: yarn install
- name: Build Frontend
run: yarn build
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Run migrations
uses: actions-rs/cargo@v1
with:
command: run
args: --bin tests-migrate
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
- name: check build
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
- name: tests
uses: actions-rs/cargo@v1
timeout-minutes: 40
with:
command: test
args: --all --all-features --no-fail-fast
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
- name: generate documentation
if: matrix.version == '1.51.0' && (github.repository == 'mCaptcha/mCaptcha')
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --workspace --all-features
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
OPEN_API_DOCS: 8e77345f1597e40c2e266cb4e6dee74888918a61
- name: Deploy to GitHub Pages
if: matrix.version == '1.51.0' && (github.repository == 'mCaptcha/mCaptcha')
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc