Continue to fine tune runtime configuration #1772
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: Meadow Tests | |
on: | |
push: | |
branches-ignore: | |
- "main" | |
- "deploy/**" | |
- "build/**" | |
jobs: | |
dependencies: | |
runs-on: ubuntu-latest | |
env: | |
MIX_ENV: test | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.tool-versions | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "26" | |
elixir-version: "1.15.4" | |
- name: Cache Elixir dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/deps | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache Elixir build | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/_build | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache JS dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/assets/node_modules | |
app/priv/nodejs/*/node_modules | |
lambdas/*/node_modules | |
key: ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
${{ runner.os }}-npm-v6- | |
- name: Install Elixir dependencies | |
run: mix do deps.get, compile | |
working-directory: app | |
- name: Install JS dependencies | |
run: | | |
npm ci --force --no-fund | |
npm list | |
working-directory: app/assets | |
- name: Install Lambda dependencies | |
run: | | |
for pkg in $(find app/priv/nodejs -maxdepth 2 -name package-lock.json) $(find lambdas -maxdepth 2 -name package-lock.json) | |
do | |
cd $(dirname $pkg) | |
npm ci --no-fund | |
cd - | |
done | |
js-test: | |
runs-on: ubuntu-latest | |
needs: dependencies | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.tool-versions | |
- name: Cache Elixir dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/deps | |
app/_build | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache Elixir build | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/_build | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache JS dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/assets/node_modules | |
app/priv/nodejs/*/node_modules | |
lambdas/*/node_modules | |
key: ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
${{ runner.os }}-npm-v6- | |
- name: JS Static Analysis | |
run: npm run-script prettier | |
working-directory: app/assets | |
- name: JS Tests | |
run: npm run-script ci:silent -- -w 1 | |
working-directory: app/assets | |
- name: Test ESBuild | |
run: npm run-script deploy | |
working-directory: app/assets | |
elixir-test: | |
runs-on: ubuntu-latest | |
needs: dependencies | |
env: | |
MIX_ENV: test | |
services: | |
db: | |
image: ghcr.io/nulib/postgres:10-alpine | |
env: | |
POSTGRES_USER: docker | |
POSTGRES_PASSWORD: d0ck3r | |
options: >- | |
--health-cmd "pg_isready -U docker" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
ldap: | |
image: ghcr.io/nulib/ldap-alpine | |
ports: | |
- 389:389 | |
- 636:636 | |
opensearch: | |
image: opensearchproject/opensearch:2.11.1 | |
env: | |
bootstrap.memory_lock: true | |
OPENSEARCH_JAVA_OPTS: "-Xms256m -Xmx256m" | |
DISABLE_INSTALL_DEMO_CONFIG: true | |
DISABLE_SECURITY_PLUGIN: true | |
discovery.type: single-node | |
ports: | |
- 9200:9200 | |
localstack: | |
image: localstack/localstack | |
env: | |
DOCKER_HOST: unix:///var/run/docker.sock | |
GATEWAY_LISTEN: 0.0.0.0:4566 | |
ports: | |
- 4566:4566 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: hashicorp/setup-terraform@v3 | |
- name: Provision Localstack using Terraform | |
run: | | |
terraform init | |
terraform apply -auto-approve -var-file test.tfvars -var localstack_endpoint=https://localhost.localstack.cloud:4566 | |
working-directory: ./infrastructure/localstack | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.tool-versions | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "26" | |
elixir-version: "1.15.4" | |
- name: Install LDAP utils | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y ldap-utils | |
- name: Install FFMPEG | |
run: | | |
mkdir -p ${{ runner.temp }}/ffmpeg && \ | |
cd ${{ runner.temp }}/ffmpeg && \ | |
curl https://s3.amazonaws.com/nul-repo-deploy/ffmpeg-release-64bit-static.tar.xz | tar xJ && \ | |
sudo cp $(find . -type f -executable) /usr/local/bin/ && \ | |
echo "FFMPEG VERSION: $(ffmpeg -version | sed -n "s/ffmpeg version \([-0-9.]*\).*/\1/p;")" | |
- name: Install ExifTool | |
run: | | |
EXIFTOOL_VERSION=$(curl -s https://exiftool.org/ver.txt) | |
mkdir -p ${{ runner.temp }}/exiftool && \ | |
cd ${{ runner.temp }}/exiftool && \ | |
curl -L -s https://exiftool.org/Image-ExifTool-${EXIFTOOL_VERSION}.tar.gz | tar xz && \ | |
cd Image-ExifTool-${EXIFTOOL_VERSION} && \ | |
perl Makefile.PL && \ | |
sudo make install | |
- name: Cache Elixir dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/deps | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache Elixir build | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/_build | |
key: ${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
restore-keys: | | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }}-${{ hashFiles('app/**/*.{ex,eex,exs}') }} | |
${{ runner.os }}-hex-v6-${{ hashFiles('app/mix.lock') }} | |
${{ runner.os }}-hex-v6- | |
- name: Cache JS dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
app/assets/node_modules | |
app/priv/nodejs/*/node_modules | |
lambdas/*/node_modules | |
key: ${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-v6-${{ hashFiles('**/package-lock.json') }} | |
${{ runner.os }}-npm-v6- | |
- name: Set SECRET_KEY_BASE | |
run: echo "SECRET_KEY_BASE=$(openssl rand -hex 32)" >> $GITHUB_ENV | |
- name: Elixir Static Analysis | |
run: mix credo | |
working-directory: app | |
- name: Elixir Tests | |
run: mix test || mix test --failed | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: app | |
- name: Test DB Rollback | |
run: mix ecto.rollback --all | |
working-directory: app |