77 - " deploy/**"
88 - " build/**"
99jobs :
10- dependencies :
10+ js-test :
1111 runs-on : ubuntu-latest
12- env :
13- MIX_ENV : test
1412 steps :
1513 - uses : actions/checkout@v2
1614 - uses : actions/setup-node@v3
1715 with :
1816 node-version-file : ./.tool-versions
17+ cache : ' npm'
18+ cache-dependency-path : |
19+ app/assets/package-lock.json
20+ app/priv/nodejs/*/package-lock.json
21+ lambdas/*/package-lock.json
1922 - name : Install NPM
2023 run : npm install -g npm@${{ env.NPM_VERSION }}
2124 env :
2225 NPM_VERSION : 11.6.0
23- - uses : erlef/setup-beam@v1
24- with :
25- otp-version : " 26"
26- elixir-version : " 1.15.4"
27- - name : Cache Elixir dependencies
28- uses : actions/cache@v4
29- with :
30- path : |
31- app/deps
32- key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
33- restore-keys : |
34- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
35- ${{ runner.os }}-hex-v6-
36- - name : Cache Elixir build
37- uses : actions/cache@v4
38- with :
39- path : |
40- app/_build
41- key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
42- restore-keys : |
43- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
44- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
45- ${{ runner.os }}-hex-v6-
46- - name : Cache JS dependencies
47- uses : actions/cache@v4
48- with :
49- path : |
50- app/assets/node_modules
51- app/priv/nodejs/*/node_modules
52- lambdas/*/node_modules
53- key : ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
54- restore-keys : |
55- ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
56- ${{ runner.os }}-npm-v6-
57- - name : Install Elixir dependencies
58- run : mix do deps.get, compile
59- working-directory : app
6026 - name : Install JS dependencies
6127 run : |
6228 npm ci --force --no-fund
6329 npm list
6430 working-directory : app/assets
65- - name : Install Lambda dependencies
66- run : |
67- for pkg in $(find app/priv/nodejs -maxdepth 2 -name package-lock.json) $(find lambdas -maxdepth 2 -name package-lock.json)
68- do
69- cd $(dirname $pkg)
70- npm ci --no-fund
71- cd -
72- done
73- js-test :
74- runs-on : ubuntu-latest
75- needs : dependencies
76- steps :
77- - uses : actions/checkout@v2
78- - uses : actions/setup-node@v3
79- with :
80- node-version-file : ./.tool-versions
81- - name : Cache Elixir dependencies
82- uses : actions/cache@v4
83- with :
84- path : |
85- app/deps
86- app/_build
87- key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
88- restore-keys : |
89- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
90- ${{ runner.os }}-hex-v6-
91- - name : Cache Elixir build
92- uses : actions/cache@v4
93- with :
94- path : |
95- app/_build
96- key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
97- restore-keys : |
98- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
99- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
100- ${{ runner.os }}-hex-v6-
101- - name : Cache JS dependencies
102- uses : actions/cache@v4
103- with :
104- path : |
105- app/assets/node_modules
106- app/priv/nodejs/*/node_modules
107- lambdas/*/node_modules
108- key : ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
109- restore-keys : |
110- ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
111- ${{ runner.os }}-npm-v6-
11231 - name : JS Static Analysis
11332 run : npm run-script prettier
11433 working-directory : app/assets
@@ -120,50 +39,26 @@ jobs:
12039 working-directory : app/assets
12140 elixir-test :
12241 runs-on : ubuntu-latest
123- needs : dependencies
12442 env :
12543 MIX_ENV : test
126- services :
127- db :
128- image : supabase/postgres:15.8.1.047
129- env :
130- POSTGRES_PASSWORD : d0ck3r
131- ports :
132- - 5432:5432
133- opensearch :
134- image : opensearchproject/opensearch:2.11.1
135- env :
136- bootstrap.memory_lock : true
137- OPENSEARCH_JAVA_OPTS : " -Xms256m -Xmx256m"
138- DISABLE_INSTALL_DEMO_CONFIG : true
139- DISABLE_SECURITY_PLUGIN : true
140- discovery.type : single-node
141- ports :
142- - 9200:9200
143- localstack :
144- image : localstack/localstack
145- env :
146- DOCKER_HOST : unix:///var/run/docker.sock
147- GATEWAY_LISTEN : 0.0.0.0:4566
148- ports :
149- - 4566:4566
150- volumes :
151- - /var/run/docker.sock:/var/run/docker.sock:ro
15244 steps :
15345 - uses : actions/checkout@v2
154- - uses : hashicorp/setup-terraform@v3
155- - name : Provision Localstack using Terraform
156- run : |
157- terraform init
158- terraform apply -auto-approve -var-file test.tfvars -var localstack_endpoint=https://localhost.localstack.cloud:4566
46+ - name : Start service containers in background
47+ run : docker compose up -d &
15948 working-directory : ./infrastructure/localstack
16049 - uses : actions/setup-node@v3
16150 with :
16251 node-version-file : ./.tool-versions
52+ cache : ' npm'
53+ cache-dependency-path : |
54+ app/assets/package-lock.json
55+ app/priv/nodejs/*/package-lock.json
56+ lambdas/*/package-lock.json
16357 - uses : erlef/setup-beam@v1
16458 with :
16559 otp-version : " 27"
16660 elixir-version : " 1.18.2"
61+ - uses : hashicorp/setup-terraform@v3
16762 - name : Install FFMPEG
16863 run : |
16964 mkdir -p ${{ runner.temp }}/ffmpeg && \
@@ -180,38 +75,39 @@ jobs:
18075 cd Image-ExifTool-${EXIFTOOL_VERSION} && \
18176 perl Makefile.PL && \
18277 sudo make install
183- - name : Cache Elixir dependencies
78+ - name : Cache Elixir dependencies and build
18479 uses : actions/cache@v4
18580 with :
18681 path : |
82+ app/_build
18783 app/deps
18884 key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
18985 restore-keys : |
19086 ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
19187 ${{ runner.os }}-hex-v6-
192- - name : Cache Elixir build
193- uses : actions/cache@v4
194- with :
195- path : |
196- app/_build
197- key : ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
198- restore-keys : |
199- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }}
200- ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}
201- ${{ runner.os }}-hex-v6-
202- - name : Cache JS dependencies
203- uses : actions/cache@v4
204- with :
205- path : |
206- app/assets/node_modules
207- app/priv/nodejs/*/node_modules
208- lambdas/*/node_modules
209- key : ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
210- restore-keys : |
211- ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }}
212- ${{ runner.os }}-npm-v6-
88+ - name : Install Elixir dependencies
89+ run : mix do deps.get, compile
90+ working-directory : app
91+ env :
92+ MIX_ENV : test
93+ - name : Install Lambda dependencies
94+ run : |
95+ for pkg in $(find app/priv/nodejs -maxdepth 2 -name package-lock.json) $(find lambdas -maxdepth 2 -name package-lock.json)
96+ do
97+ cd $(dirname $pkg)
98+ npm ci --no-fund
99+ cd -
100+ done
101+ - name : Wait for services to be ready
102+ run : timeout 60 bash -c 'while ! ./all-healthy.sh; do sleep 2; done'
103+ working-directory : ./infrastructure/localstack
213104 - name : Set SECRET_KEY_BASE
214105 run : echo "SECRET_KEY_BASE=$(openssl rand -hex 32)" >> $GITHUB_ENV
106+ - name : Provision Localstack using Terraform
107+ run : |
108+ terraform init
109+ terraform apply -auto-approve -var-file test.tfvars -var localstack_endpoint=https://localhost.localstack.cloud:4566
110+ working-directory : ./infrastructure/localstack
215111 - name : Elixir Static Analysis
216112 run : mix credo
217113 working-directory : app
0 commit comments