2019-10-10 03:01:41 +03:00
|
|
|
name: CI
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2020-04-27 13:59:51 +03:00
|
|
|
on: push
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
jobs:
|
|
|
|
test:
|
2023-09-22 19:03:21 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
services:
|
|
|
|
db:
|
|
|
|
image: postgres:10
|
2020-04-07 14:47:33 +03:00
|
|
|
env:
|
|
|
|
POSTGRES_DB: accent_test
|
|
|
|
POSTGRES_PASSWORD: password
|
2023-12-22 19:08:59 +03:00
|
|
|
ports: ['5432:5432']
|
2020-04-07 14:47:33 +03:00
|
|
|
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
|
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
steps:
|
2023-09-22 19:03:21 +03:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2023-09-22 20:11:45 +03:00
|
|
|
- uses: erlef/setup-beam@v1
|
|
|
|
id: setup-beam
|
2019-10-10 03:01:41 +03:00
|
|
|
with:
|
2023-09-22 20:11:45 +03:00
|
|
|
version-file: .tool-versions
|
|
|
|
version-type: strict
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
deps
|
|
|
|
_build
|
|
|
|
priv/plts
|
|
|
|
key: ${{ runner.os }}-mix-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles(format('{0}/mix.lock', github.workspace)) }}
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2024-08-13 23:43:01 +03:00
|
|
|
- uses: actions/setup-node@v4
|
2019-10-10 03:01:41 +03:00
|
|
|
with:
|
2023-09-22 20:11:45 +03:00
|
|
|
node-version-file: .tool-versions
|
|
|
|
cache: npm
|
|
|
|
cache-dependency-path: |
|
|
|
|
package-lock.json
|
|
|
|
cli/package-lock.json
|
|
|
|
jipt/package-lock.json
|
|
|
|
webapp/package-lock.json
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Install System Dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2023-09-22 19:03:21 +03:00
|
|
|
sudo apt-get install -y gcc libyaml-dev
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Install Elixir Dependencies
|
|
|
|
run: |
|
|
|
|
mix local.rebar --force
|
|
|
|
mix local.hex --force
|
|
|
|
mix deps.get
|
|
|
|
mix deps.compile
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Install NodeJS Dependencies
|
|
|
|
run: |
|
2024-02-15 06:52:52 +03:00
|
|
|
npm set fund false
|
|
|
|
npm set audit false
|
|
|
|
npm set color false
|
|
|
|
npm ci
|
|
|
|
npm ci --prefix webapp
|
|
|
|
npm ci --prefix cli
|
|
|
|
npm ci --prefix jipt
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Build webapp production
|
|
|
|
run: npm run build-production-inline --prefix webapp
|
2020-04-07 14:47:33 +03:00
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
2020-04-07 14:47:33 +03:00
|
|
|
mix ecto.setup
|
|
|
|
./priv/scripts/ci-check.sh
|
|
|
|
|
2019-10-10 03:01:41 +03:00
|
|
|
- name: Build CLI
|
|
|
|
run: npm --prefix cli run build
|
|
|
|
- name: Build JIPT
|
|
|
|
run: npm --prefix jipt run build-production-inline
|
|
|
|
- name: Coverage report
|
2020-04-07 14:47:33 +03:00
|
|
|
run: mix coveralls.post --token ${{ secrets.COVERALLS_REPO_TOKEN }} --name 'github-actions' --branch ${{ github.ref }} --committer ${{ github.actor }} --sha ${{ github.sha }}
|
2020-05-08 00:34:44 +03:00
|
|
|
|
2023-09-22 19:03:21 +03:00
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
2020-05-08 00:34:44 +03:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2023-09-22 19:03:21 +03:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
2023-09-22 20:43:34 +03:00
|
|
|
password: ${{ secrets.MIREGO_GITHUB_PACKAGES_ACCESS_TOKEN }}
|
2023-09-22 19:03:21 +03:00
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
mirego/accent
|
|
|
|
ghcr.io/mirego/accent
|
|
|
|
tags: |
|
2023-09-22 20:21:57 +03:00
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2023-09-22 19:03:21 +03:00
|
|
|
type=semver,pattern={{raw}}
|
|
|
|
- uses: docker/build-push-action@v5
|
|
|
|
with:
|
2023-12-22 19:08:59 +03:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2023-09-22 19:03:21 +03:00
|
|
|
context: .
|
2020-05-08 00:34:44 +03:00
|
|
|
push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
|
2023-09-22 19:03:21 +03:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|