|
1 | | -name: Github Actions CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [ "main" ] |
6 | | - pull_request: |
7 | | - |
8 | | -jobs: |
9 | | - build: |
10 | | - # Containers must run in Linux based operating systems |
11 | | - runs-on: ubuntu-20.04 |
12 | | - name: Build and test |
13 | | - env: |
14 | | - MIX_ENV: test |
15 | | - |
16 | | - strategy: |
17 | | - matrix: |
18 | | - otp: ['26.2'] |
19 | | - elixir: ['1.15.7'] |
20 | | - |
21 | | - services: |
22 | | - postgres: |
23 | | - image: postgres:13-alpine |
24 | | - env: |
25 | | - POSTGRES_USER: postgres |
26 | | - POSTGRES_PASSWORD: postgres |
27 | | - POSTGRES_DB: bitcrowd_ecto_test |
28 | | - ports: |
29 | | - - 5432:5432 |
30 | | - options: >- |
31 | | - --health-cmd pg_isready |
32 | | - --health-interval 10s |
33 | | - --health-timeout 5s |
34 | | - --health-retries 5 |
35 | | -
|
36 | | - steps: |
37 | | - - name: Check out repository code |
38 | | - uses: actions/checkout@v3 |
39 | | - |
40 | | - - name: Set up Elixir |
41 | | - uses: erlef/setup-beam@v1 |
42 | | - with: |
43 | | - otp-version: ${{matrix.otp}} |
44 | | - elixir-version: ${{matrix.elixir}} |
45 | | - version-type: 'strict' |
46 | | - |
47 | | - - run: mix local.hex --force |
48 | | - - run: mix local.rebar --force |
49 | | - |
50 | | - - name: Restore dependencies cache |
51 | | - uses: actions/cache@v3 |
52 | | - with: |
53 | | - path: deps |
54 | | - key: v1-mix-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
55 | | - restore-keys: v1-mix-${{ runner.os }} |
56 | | - |
57 | | - - name: Restore build cache |
58 | | - uses: actions/cache@v3 |
59 | | - with: |
60 | | - path: _build |
61 | | - key: v1-build-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
62 | | - restore-keys: v1-build-${{ runner.os }} |
63 | | - |
64 | | - - name: Install dependencies |
65 | | - run: mix do deps.get, compile |
66 | | - |
67 | | - - name: Restore plts cache |
68 | | - uses: actions/cache@v3 |
69 | | - with: |
70 | | - path: _plts |
71 | | - key: v1-plt-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
72 | | - restore-keys: v1-plt-${{ runner.os }} |
73 | | - |
74 | | - - name: Linter |
75 | | - run: mix lint |
76 | | - |
77 | | - - name: Init DB |
78 | | - run: mix do ecto.create, ecto.migrate |
79 | | - |
80 | | - - name: Run tests |
81 | | - run: mix test |
| 1 | +name: Github Actions CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + # Containers must run in Linux based operating systems |
| 11 | + runs-on: ubuntu-24.04 |
| 12 | + name: Build and test |
| 13 | + env: |
| 14 | + MIX_ENV: test |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + otp: ["28.3"] |
| 19 | + elixir: ["1.19.4"] |
| 20 | + |
| 21 | + services: |
| 22 | + postgres: |
| 23 | + image: postgres:17-alpine |
| 24 | + env: |
| 25 | + POSTGRES_USER: postgres |
| 26 | + POSTGRES_PASSWORD: postgres |
| 27 | + POSTGRES_DB: bitcrowd_ecto_test |
| 28 | + ports: |
| 29 | + - 5432:5432 |
| 30 | + options: >- |
| 31 | + --health-cmd pg_isready |
| 32 | + --health-interval 10s |
| 33 | + --health-timeout 5s |
| 34 | + --health-retries 5 |
| 35 | +
|
| 36 | + steps: |
| 37 | + - name: Check out repository code |
| 38 | + uses: actions/checkout@v3 |
| 39 | + |
| 40 | + - name: Set up Elixir |
| 41 | + uses: erlef/setup-beam@v1 |
| 42 | + with: |
| 43 | + otp-version: ${{matrix.otp}} |
| 44 | + elixir-version: ${{matrix.elixir}} |
| 45 | + version-type: "strict" |
| 46 | + |
| 47 | + - run: mix local.hex --force |
| 48 | + - run: mix local.rebar --force |
| 49 | + |
| 50 | + - name: Restore dependencies cache |
| 51 | + uses: actions/cache@v3 |
| 52 | + with: |
| 53 | + path: deps |
| 54 | + key: v1-mix-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
| 55 | + restore-keys: v1-mix-${{ runner.os }} |
| 56 | + |
| 57 | + - name: Restore build cache |
| 58 | + uses: actions/cache@v3 |
| 59 | + with: |
| 60 | + path: _build |
| 61 | + key: v1-build-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
| 62 | + restore-keys: v1-build-${{ runner.os }} |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: mix do deps.get, compile |
| 66 | + |
| 67 | + - name: Restore plts cache |
| 68 | + uses: actions/cache@v3 |
| 69 | + with: |
| 70 | + path: _plts |
| 71 | + key: v1-plt-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} |
| 72 | + restore-keys: v1-plt-${{ runner.os }} |
| 73 | + |
| 74 | + - name: Linter |
| 75 | + run: mix lint |
| 76 | + |
| 77 | + - name: Init DB |
| 78 | + run: mix do ecto.create, ecto.migrate |
| 79 | + |
| 80 | + - name: Run tests |
| 81 | + run: mix test |
0 commit comments