|
8 | 8 | jobs: |
9 | 9 | test: |
10 | 10 | name: Setup, Build, Test |
11 | | - uses: brianmay/workflows/.github/workflows/elixir.yaml@b751c43c6ad3df6d5ef91a3ff5a263344169e332 # main |
12 | | - with: |
13 | | - plts_cache_postfix: "-5" |
14 | | - apt_packages: "graphicsmagick-imagemagick-compat libimage-exiftool-perl ffmpeg exiftran libraw-bin" |
15 | | - test_data: "https://www.dropbox.com/s/yg6jdk9lfewn8yf/penguin_memories.tar?dl=0" |
16 | | - test_sha256: "1be2094961977dc393b7312b8799259b2026b4570c4591bc6759dbfbfb0fe146" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + if: ${{ github.repository_owner != 'brianmay' || github.event_name != 'pull_request' }} |
| 13 | + |
| 14 | + # Service containers to run with `container-job` |
| 15 | + services: |
| 16 | + # Label used to access the service container |
| 17 | + postgres: |
| 18 | + # Docker Hub image |
| 19 | + image: postgis/postgis |
| 20 | + ports: ["5432:5432"] |
| 21 | + # Provide the password for postgres |
| 22 | + env: |
| 23 | + POSTGRES_USER: postgres |
| 24 | + POSTGRES_PASSWORD: postgres |
| 25 | + POSTGRES_DB: test |
| 26 | + # Set health checks to wait until postgres has started |
| 27 | + options: >- |
| 28 | + --health-cmd pg_isready |
| 29 | + --health-interval 10s |
| 30 | + --health-timeout 5s |
| 31 | + --health-retries 5 |
| 32 | +
|
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + elixir: [1.20.0-rc.6] |
| 36 | + otp: [29.0.1] |
| 37 | + |
| 38 | + env: |
| 39 | + DATABASE_URL_TEST: postgresql://postgres:postgres@localhost/test?sslmode=disable |
| 40 | + MIX_ENV: test |
| 41 | + BUILD_WITHOUT_QUIC: true |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v6 |
| 45 | + - name: Install system dependancies |
| 46 | + run: | |
| 47 | + sudo apt-get update --yes |
| 48 | + sudo apt-get install --yes graphicsmagick-imagemagick-compat libimage-exiftool-perl ffmpeg exiftran libraw-bin |
| 49 | + - name: Setup elixir |
| 50 | + uses: erlef/setup-elixir@v1.24 |
| 51 | + with: |
| 52 | + elixir-version: ${{ matrix.elixir }} |
| 53 | + otp-version: ${{ matrix.otp }} |
| 54 | + - name: Retrieve Mix Dependencies Cache |
| 55 | + uses: actions/cache@v5 |
| 56 | + id: mix-cache # id to use in retrieve action |
| 57 | + with: |
| 58 | + path: deps |
| 59 | + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('mix.lock') }} |
| 60 | + - name: Install Mix Dependencies |
| 61 | + if: ${{ steps.mix-cache.outputs.cache-hit != 'true' }} |
| 62 | + run: | |
| 63 | + mix local.rebar --force |
| 64 | + mix local.hex --force |
| 65 | + mix deps.get |
| 66 | + - name: Build |
| 67 | + run: | |
| 68 | + mix compile |
| 69 | + - name: Build NPM assets |
| 70 | + run: | |
| 71 | + npm install --prefix assets |
| 72 | + npm run deploy --prefix assets |
| 73 | + - name: Check Formatting |
| 74 | + run: mix format --check-formatted |
| 75 | + - name: Run Credo |
| 76 | + run: mix credo --strict |
| 77 | + - name: Download and extract test data |
| 78 | + run: | |
| 79 | + wget https://www.dropbox.com/s/yg6jdk9lfewn8yf/penguin_memories.tar?dl=0 -O test_data.tar |
| 80 | + echo "1be2094961977dc393b7312b8799259b2026b4570c4591bc6759dbfbfb0fe146 test_data.tar" | sha256sum --check |
| 81 | + tar -xvf test_data.tar |
| 82 | + - name: Run Tests |
| 83 | + run: mix test |
| 84 | + |
| 85 | + dialyzer: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + if: ${{ github.repository_owner != 'brianmay' || github.event_name != 'pull_request' }} |
| 88 | + |
| 89 | + strategy: |
| 90 | + matrix: |
| 91 | + elixir: [1.20.0-rc.6] |
| 92 | + otp: [29.0.1] |
| 93 | + |
| 94 | + env: |
| 95 | + MIX_ENV: test |
| 96 | + BUILD_WITHOUT_QUIC: true |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v6 |
| 100 | + - name: Setup elixir |
| 101 | + uses: erlef/setup-elixir@v1.24 |
| 102 | + with: |
| 103 | + elixir-version: ${{ matrix.elixir }} |
| 104 | + otp-version: ${{ matrix.otp }} |
| 105 | + - name: Retrieve Mix Dependencies Cache |
| 106 | + uses: actions/cache@v5 |
| 107 | + id: mix-cache # id to use in retrieve action |
| 108 | + with: |
| 109 | + path: deps |
| 110 | + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('mix.lock') }} |
| 111 | + - name: Retrieve PLT Cache |
| 112 | + uses: actions/cache@v5 |
| 113 | + id: plt-cache |
| 114 | + with: |
| 115 | + path: priv/plts |
| 116 | + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles('mix.lock') }}-5 |
| 117 | + - name: Install Mix Dependencies |
| 118 | + if: ${{ steps.mix-cache.outputs.cache-hit != 'true' }} |
| 119 | + run: | |
| 120 | + mix local.rebar --force |
| 121 | + mix local.hex --force |
| 122 | + mix deps.get |
| 123 | + - name: Build |
| 124 | + run: | |
| 125 | + mix compile |
| 126 | + - name: Create PLTs |
| 127 | + if: ${{ steps.plt-cache.outputs.cache-hit != 'true' }} |
| 128 | + run: | |
| 129 | + mkdir -p priv/plts |
| 130 | + mix dialyzer --plt |
| 131 | + - name: Run dialyzer |
| 132 | + run: mix dialyzer --no-check |
0 commit comments