chore(deps): update eslint (major) #696
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
merge_group: | |
jobs: | |
setup: | |
name: asdf and Elixir dependencies | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key-asdf: ${{ steps.cache-keys.outputs.asdf }} | |
cache-key-mix-deps: ${{ steps.cache-keys.outputs.mix-deps }} | |
cache-key-node-modules: ${{ steps.cache-keys.outputs.node-modules }} | |
cache-key-node-modules-restore: ${{ steps.cache-keys.outputs.node-modules }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set cache keys | |
id: cache-keys | |
run: | | |
echo "asdf-restore=cache-asdf-" >> $GITHUB_OUTPUT | |
echo "asdf=cache-asdf-${{ hashFiles('.tool-versions') }}" >> $GITHUB_OUTPUT | |
echo "mix-deps-restore=cache-mix-deps-" >> $GITHUB_OUTPUT | |
echo "mix-deps=cache-mix-deps-${{ hashFiles('mix.exs', 'mix.lock', '.tool-versions') }}" >> $GITHUB_OUTPUT | |
echo "node-modules-restore=cache-node-modules-" >> $GITHUB_OUTPUT | |
echo "node-modules=cache-node-modules-${{ hashFiles('package-lock.json', '.tool-versions') }}" >> $GITHUB_OUTPUT | |
- name: asdf cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.asdf | |
key: ${{ steps.cache-keys.outputs.asdf }} | |
restore-keys: ${{ steps.cache-keys.outputs.asdf-restore }} | |
id: asdf-cache | |
- uses: asdf-vm/actions/install@v3 | |
# only run `asdf install` if we didn't hit the cache | |
if: steps.asdf-cache.outputs.cache-hit != 'true' | |
- name: Setup asdf environment | |
uses: mbta/actions/reshim-asdf@v2 | |
- name: mix rebar and hex | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
# mix rebar and hex are cached with asdf, not with mix | |
if: steps.asdf-cache.outputs.cache-hit != 'true' | |
- name: Restore Mix cache, with partial | |
id: mix-deps-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ steps.cache-keys.outputs.mix-deps }} | |
restore-keys: ${{ steps.cache-keys.outputs.mix-deps-restore }} | |
- name: Install and compile Mix dependencies | |
if: steps.deps-cache.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get | |
MIX_ENV=test mix deps.compile | |
elixir: | |
name: Build and test Elixir | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
needs: setup | |
env: | |
DATABASE_USERNAME: postgres | |
DATABASE_PASSWORD: postgres | |
DATABASE_HOST: localhost | |
DATABASE_NAME: orbit_test | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: ${{env.DATABASE_USERNAME}} | |
POSTGRES_PASSWORD: ${{env.DATABASE_PASSWORD}} | |
POSTGRES_DB: ${{env.DATABASE_NAME}} | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: asdf cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/.asdf | |
key: ${{ needs.setup.outputs.cache-key-asdf }} | |
- name: Setup asdf environment | |
uses: mbta/actions/reshim-asdf@v2 | |
- uses: actions/checkout@v4 | |
- name: Restore Mix cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ needs.setup.outputs.cache-key-mix-deps }} | |
- name: Compile (warnings as errors) | |
run: mix compile --force --warnings-as-errors | |
- name: Credo | |
run: mix credo | |
- name: Check formatting | |
run: mix format --check-formatted | |
- name: Run tests | |
run: mix test | |
env: | |
DATABASE_USERNAME: ${{env.DATABASE_USERNAME}} | |
DATABASE_PASSWORD: ${{env.DATABASE_PASSWORD}} | |
DATABASE_HOST: ${{env.DATABASE_HOST}} | |
DATABASE_NAME: ${{env.DATABASE_NAME}} | |
- uses: mbta/actions/dialyzer@v2 | |
- name: Check for unused dependencies | |
run: mix deps.unlock --check-unused | |
- name: Sobelow (security analysis) | |
run: mix sobelow | |
frontend: | |
name: Frontend tests | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: asdf cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ~/.asdf | |
key: ${{ needs.setup.outputs.cache-key-asdf }} | |
- name: Setup asdf environment | |
uses: mbta/actions/reshim-asdf@v2 | |
- uses: actions/checkout@v4 | |
- name: Restore Mix cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ needs.setup.outputs.cache-key-mix-deps }} | |
- name: Restore node_modules cache, with partial | |
id: node-modules-cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ needs.setup.outputs.cache-key-node-modules }} | |
restore-keys: ${{ needs.setup.outputs.cache-key-node-modules-restore }} | |
- name: npm ci | |
if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: npm test | |
run: npm test | |
docker: | |
name: Check that the Docker container will build and run | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: docker build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
load: true | |
- name: docker compose build | |
run: docker compose build | |
- name: docker compose up | |
run: docker compose up --wait | |
- name: ensure running properly | |
run: docker compose exec --no-TTY orbit wget --spider -S http://localhost:4001/_health | |
- name: show docker container logs | |
run: docker compose logs orbit | |
if: ${{ !cancelled() }} |