Update phoenix_ecto to version 4.6.3 #334
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
MIX_ENV: test | |
DATABASE_USER: postgres | |
DATABASE_PASSWORD: postgres | |
DATABASE_NAME: test_db | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
# Dockerhub image | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-file: ".tool-versions" | |
version-type: "strict" | |
# Step: Define how to cache deps. Restores existing cache if present. | |
- name: Cache deps | |
id: cache-deps | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-elixir-deps | |
with: | |
path: deps | |
key: deps-${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix-${{ env.cache-name }}- | |
# Step: Define how to cache the `_build` directory. After the first run, | |
# this speeds up tests runs a lot. This includes not re-compiling our | |
# project's downloaded deps every run. | |
- name: Cache compiled build | |
id: cache-build | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-compiled-build | |
with: | |
path: _build | |
key: _build-${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
_build-${{ runner.os }}-mix-${{ env.cache-name }}- | |
_build-${{ runner.os }}-mix- | |
# Step: Conditionally bust the cache when job is re-run. | |
# Sometimes, we may have issues with incremental builds that are fixed by | |
# doing a full recompile. In order to not waste dev time on such trivial | |
# issues (while also reaping the time savings of incremental builds for | |
# *most* day-to-day development), force a full recompile only on builds | |
# that are retried. | |
- name: Clean to rule out incremental build as a source of flakiness | |
if: github.run_attempt != '1' | |
run: | | |
mix deps.clean --all | |
mix clean | |
shell: sh | |
- name: Install deps, compile deps, and build PLTs | |
run: mix do deps.get, deps.compile, dialyzer --plt | |
- name: Run Check | |
run: mix check | |
env: | |
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
cd: | |
name: Deploy apps | |
needs: [ci] | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy website | |
run: flyctl deploy --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_WEBSITE_API_TOKEN }} | |
- name: Deploy metrics app | |
run: flyctl deploy --remote-only ./livebook/ | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_METRICS_API_TOKEN }} |