Skip to content

Merge pull request #343 from Flo0807/install-heroicons-via-mix #562

Merge pull request #343 from Flo0807/install-heroicons-via-mix

Merge pull request #343 from Flo0807/install-heroicons-via-mix #562

Workflow file for this run

name: CI
on:
push:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Test app
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine@sha256:0bcc5bbbb2aa9c9b4c6505845918c7eb55d783cf5c1f434fac33012579fb149d
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
-p 5432:5432
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2
id: beam
with:
version-file: .tool-versions
version-type: strict
- name: Restore the deps and _build cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: restore-cache
env:
OTP_VERSION: ${{ steps.beam.outputs.otp-version }}
ELIXIR_VERSION: ${{ steps.beam.outputs.elixir-version }}
MIX_LOCK_HASH: ${{ hashFiles('**/mix.lock') }}
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-mixlockhash-${{ env.MIX_LOCK_HASH }}
- name: Install mix dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: Compile dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: mix deps.compile
- name: Compile
run: mix compile --warnings-as-errors --force
- name: Check Formatting
run: mix format --check-formatted
- name: Gettext
run: mix gettext.extract --check-up-to-date
- name: Credo
run: mix credo
- name: Run Tests
run: mix test
build-push:
name: Build and push image to ghcr
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Lowercase image name
run: echo "IMAGE_NAME=$(echo "$IMAGE_NAME" | awk '{print tolower($0)}')" >> $GITHUB_ENV
- name: Log in to the container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
build-args: FLY_IO_RELEASE="false"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
deploy:
name: Deploy app to fly.io
runs-on: ubuntu-latest
needs: build-push
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only