mirror of
https://github.com/mirego/accent.git
synced 2024-09-20 15:17:13 +03:00
78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
db:
|
|
image: postgres:10
|
|
env:
|
|
POSTGRES_DB: accent_test
|
|
POSTGRES_PASSWORD: password
|
|
ports: ["5432:5432"]
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
env:
|
|
MIX_ENV: test
|
|
DATABASE_URL: postgres://postgres:password@localhost/accent_test
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: erlef/setup-elixir@v1
|
|
with:
|
|
otp-version: 24.0.2
|
|
elixir-version: 1.13.x
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16.13.x
|
|
cache: 'npm'
|
|
|
|
- name: Install System Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc libyaml-dev python-yaml
|
|
|
|
- name: Install Elixir Dependencies
|
|
run: |
|
|
mix local.rebar --force
|
|
mix local.hex --force
|
|
mix deps.get
|
|
mix deps.compile
|
|
|
|
- name: Install NodeJS Dependencies
|
|
run: |
|
|
npm config set spin false
|
|
npm i --no-audit --no-color
|
|
npm i --prefix webapp --no-audit --no-color
|
|
npm i --prefix cli --no-audit --no-color
|
|
npm i --prefix jipt --no-audit --no-color
|
|
|
|
- name: Build webapp production
|
|
run: npm run build-production-inline --prefix webapp
|
|
|
|
- name: Run Tests
|
|
run: |
|
|
mix ecto.setup
|
|
./priv/scripts/ci-check.sh
|
|
|
|
- name: Build CLI
|
|
run: npm --prefix cli run build
|
|
- name: Build JIPT
|
|
run: npm --prefix jipt run build-production-inline
|
|
- name: Coverage report
|
|
run: mix coveralls.post --token ${{ secrets.COVERALLS_REPO_TOKEN }} --name 'github-actions' --branch ${{ github.ref }} --committer ${{ github.actor }} --sha ${{ github.sha }}
|
|
|
|
- uses: docker/build-push-action@v1
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
repository: mirego/accent
|
|
tag_with_ref: true
|
|
push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
|