Files
music_library/.github/workflows/test_and_deploy.yml
T
Claudio Ortolina f0151de808 Force Node.js 24 on test/deploy CI
Following a deprecation from GitHub:
> ! Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: erlef/setup-beam@v1. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
2026-03-11 15:59:32 +00:00

117 lines
4.8 KiB
YAML

name: Test & Deploy
on: push
jobs:
test:
name: Test
runs-on: ubuntu-24.04
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v6
- uses: erlef/setup-beam@v1
id: setup-beam
with:
version-type: strict
version-file: .tool-versions
- name: Cache deps
id: cache-deps
uses: actions/cache@v5
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-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@v5
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-
${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-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: Add Fluxon UI repo
run: |
mix hex.repo add fluxon https://repo.fluxonui.com \
--fetch-public-key $FLUXON_KEY_FINGERPRINT \
--auth-key $FLUXON_LICENSE_KEY
env:
FLUXON_LICENSE_KEY: ${{ secrets.FLUXON_LICENSE_KEY }}
FLUXON_KEY_FINGERPRINT: ${{ secrets.FLUXON_KEY_FINGERPRINT }}
- name: Fetch dependencies
run: mix deps.get
- name: 📦 Check unused dependencies
run: mix deps.unlock --check-unused
- name: 🔮 Compile for DEV
run: mix compile
env:
MIX_ENV: dev
# Half the number of available cores
# See https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
MIX_OS_DEPS_COMPILE_PARTITION_COUNT: 2
- name: 🔮 Compile for TEST
run: mix compile
env:
MIX_ENV: test
# Half the number of available cores
# See https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
MIX_OS_DEPS_COMPILE_PARTITION_COUNT: 2
- name: 🌍 Check translations
run: mix gettext.extract --check-up-to-date
- name: 💅 Check formatting
run: mix format --check-formatted
- name: 👨‍🏫 Check Credo
run: mix credo --strict
- name: 👮 Run Sobelow
run: mix sobelow
- name: 🧪 Run tests
run: mix test
env:
CLOAK_ENCRYPTION_KEY: f5ol1dJROsm9yi/tvtHiblN8aLH1FUN/obEvUcASx3U=
deploy:
name: Deploy
needs: test
runs-on: ubuntu-latest
environment: production
if: github.ref == 'refs/heads/main'
concurrency: deploy-group
steps:
- uses: actions/checkout@v6
- uses: gacts/install-hurl@v1
- name: 🚀 Deploy to production
run: hurl --test --report-tap deploy.tap scripts/prod/deploy.hurl
env:
HURL_coolify_token: ${{ secrets.COOLIFY_TOKEN }}
HURL_coolify_host: ${{ vars.COOLIFY_HOST }}
HURL_coolify_app_uuid: ${{ vars.COOLIFY_APP_UUID }}
- name: ⏳ Wait for container to start
run: hurl --test --report-tap healthcheck.tap test/healthcheck.hurl
- name: ✅ Run verification tests
run: hurl --test --report-tap verification.tap test/prod.hurl
env:
HURL_api_token: ${{ secrets.API_TOKEN }}
- uses: pcolby/tap-summary@v1