librepages/.github/workflows/linux.yml

120 lines
3.7 KiB
YAML
Raw Normal View History

2021-10-29 20:27:34 +05:30
name: Build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
- "*"
- "!gh-pages"
2021-10-29 20:27:34 +05:30
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
#- 1.51.0
- stable
# - nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
2022-09-10 19:29:22 +05:30
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
2021-10-29 20:27:34 +05:30
steps:
- uses: actions/checkout@v2
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
2021-10-29 20:52:01 +05:30
/var/lib/docker
2021-10-29 20:27:34 +05:30
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
2022-09-16 17:42:27 +05:30
- uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: download deps
run: make dev-env
env:
LPCONDUCTOR_CREDS_USERNAME: "librepages_api"
LPCONDUCTOR_CREDS_PASSWORD: "longrandomlygeneratedpassword"
2022-09-16 17:42:27 +05:30
2022-08-16 10:42:35 +05:30
- name: configure GPG key
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/librepages'
run: echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback
env:
RELEASE_BOT_GPG_SIGNING_KEY: ${{ secrets.RELEASE_BOT_GPG_SIGNING_KEY }}
2021-10-29 20:47:44 +05:30
- name: Login to DockerHub
2022-08-16 10:42:35 +05:30
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/librepages'
2021-10-29 20:47:44 +05:30
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2021-10-29 20:27:34 +05:30
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
2022-09-10 19:29:22 +05:30
- name: build and apply migrations
run: make migrate
env:
2022-09-10 20:10:17 +05:30
DATABASE_URL: "postgres://postgres:password@localhost:5432/postgres"
2021-10-29 20:27:34 +05:30
- name: run tests
run: make test
2022-09-10 19:29:22 +05:30
env:
DATABASE_URL: "postgres://postgres:password@localhost:5432/postgres"
2021-10-29 20:47:44 +05:30
- name: make docker images
run: make docker
- name: publish docker images
2022-09-16 13:23:19 +05:30
if: (github.ref == 'refs/heads/master' && github.event_name == 'push') && github.repository == 'realaravinth/librepages'
2021-10-29 20:47:44 +05:30
run: make docker-publish
2022-08-16 10:42:35 +05:30
- name: publish bins
2022-09-16 13:23:19 +05:30
if: (github.ref == 'refs/heads/master' && github.event_name == 'push') && github.repository == 'realaravinth/librepages'
run: ./scripts/bin-publish.sh publish master latest $DUMBSERVE_PASSWORD
2022-08-16 10:42:35 +05:30
env:
DUMBSERVE_PASSWORD: ${{ secrets.DUMBSERVE_PASSWORD }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
2021-10-29 20:27:34 +05:30
- name: generate documentation
2022-08-16 15:02:52 +05:30
if: matrix.version == 'stable' && (github.repository == 'realaravinth/librepages')
2021-10-29 20:27:34 +05:30
run: make doc
env:
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
2022-09-10 19:29:22 +05:30
DATABASE_URL: "postgres://postgres:password@localhost:5432/postgres"
2021-10-29 20:27:34 +05:30
- name: Deploy to GitHub Pages
2022-08-16 10:42:35 +05:30
if: matrix.version == 'stable' && (github.repository == 'realaravinth/librepages')
2021-10-29 20:27:34 +05:30
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc