forked from metarhia/Example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80b1048
commit a6e0d06
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Testing CI | ||
|
||
on: | ||
- pull_request | ||
- push | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
node: | ||
- 18 | ||
- 20 | ||
os: | ||
# - ubuntu-latest | ||
- windows-latest | ||
# - macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup docker (missing on MacOS) | ||
if: runner.os == 'macos' | ||
run: | | ||
brew install docker | ||
brew install docker-compose | ||
mkdir -p ~/.docker/cli-plugins | ||
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose | ||
colima start | ||
# For testcontainers to find the Colima socket | ||
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running | ||
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | ||
- name: Setup pg (on Windows) | ||
if: runner.os == 'windows' | ||
run: | | ||
Start-Service postgresql | ||
Start-Sleep -Seconds 15 | ||
cd database | ||
bash setup.sh | ||
# Invoke-WebRequest -Uri https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe -OutFile jq.exe | ||
# .\jq.exe '. + {"experimental": true}' C:\ProgramData\Docker\config\daemon.json | Set-Content -Path C:\ProgramData\Docker\config\daemon.json | ||
# type C:\ProgramData\Docker\config\daemon.json | ||
# Restart-Service Docker | ||
docker info | ||
# Invoke-WebRequest -Uri "https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?_gl=1*1h68n6z*_ga*MTE2MjkxMTYzMS4xNjk2MjYwNjc1*_ga_XJWPQMJYHQ*MTcwMzgwOTg0MS4yMi4xLjE3MDM4MTA1MzAuMjcuMC4w" -o ddi.exe | ||
# Start-Process 'ddi.exe' -Wait install | ||
# dir "C:\ProgramData\Docker" | ||
# .\DockerCli.exe -SwitchDaemon | ||
# Get-ChildItem -Path "C:\ProgramData\Docker" -Filter "DockerCli.exe" -Recurse | ||
- name: Start docker containers | ||
if: runner.os != 'windows' | ||
run: | | ||
docker-compose -f test-docker-compose.yml up -d pg-example redis-example | ||
sleep 10 # wait for database to be ready | ||
- name: Use Node.js ${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- run: npm ci | ||
|
||
- run: npm run dotest | ||
env: | ||
MODE: test |