Skip to content

Commit

Permalink
ci: e2e updates. (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney authored Jan 16, 2024
1 parent c472b30 commit 7175c31
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,33 @@ on:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install docker
run: |
brew install docker docker-compose
mkdir -p ~/.docker/cli-plugins
ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
colima start --arch x86_64
- name: Apt Pkgs
if: runner.os == 'ubuntu'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libnss3-tools
version: 1.3.1
- name: Install mkcert
if: runner.os == 'ubuntu'
run: |
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
- name: Install mkcert (macos)
if: runner.os == 'macos'
run: |
brew install mkcert
brew install nss
- name: Install Certificates
run: |
mkcert -install
Expand All @@ -31,22 +44,21 @@ jobs:
node-version: '20.10.0'
- name: Install Dependencies
run: npm ci
- name: Install Playwright Deps
run: npx playwright install-deps chrome webkit
- name: Install Playwright Browsers
run: npx playwright install chrome webkit
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run Tests
run: npm test
env:
CI: true
SERVER_NAME: localhost
HOST_NAME: localhost
UPSTREAM_API_HOST: api
SSL_CERT_PATH: /etc/ci/file.pem
SSL_KEY_PATH: /etc/ci/file.key
BM_SESSION_STORE: memory
BM_COOKIE_SECURE: false
BM_COOKIE_SAMESITE: lax
SSL_CERT_PATH: /etc/nginx/certs/busmap.localhost.pem
SSL_KEY_PATH: /etc/nginx/certs/busmap.localhost-key.pem
BM_REDIS_HOST: redis://session
BM_SESSION_STORE: redis
BM_COOKIE_SECURE: true
BM_COOKIE_SAMESITE: strict
BM_COOKIE_SECRET: ${{ secrets.BM_COOKIE_SECRET }}
BM_POSTGRES_PASSWORD: ${{ secrets.BM_POSTGRES_PASSWORD }}
BM_POSTGRES_USER: ${{ secrets.BM_POSTGRES_USER }}
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if (env.BM_SESSION_STORE === 'redis') {
url: env.BM_REDIS_HOST,
socket: {
reconnectStrategy(retries, cause) {
if (/ENOTFOUND/i.test(cause.message) && retries > 3) {
logger.warn('Redis host not found, done reconnecting.')
if (/ENOTFOUND|ECONNREFUSED/i.test(cause.message) && retries > 3) {
logger.warn('Redis host not found or accepting connections, done reconnecting.')

return false
}
Expand Down
7 changes: 4 additions & 3 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ export default defineConfig({

/* Run your local dev server before starting the tests */
webServer: {
command: 'docker compose up --attach-dependencies dev',
url: 'http://localhost:3000/health',
command: 'docker compose -f compose.yaml up --attach-dependencies stage',
ignoreHTTPSErrors: true,
url: 'https://localhost/healthcheck',
reuseExistingServer: !process.env.CI,
timeout: 60_000 * 7,
timeout: 60_000 * 5,
stdout: 'pipe'
}
})

0 comments on commit 7175c31

Please sign in to comment.