name: fetch npm modules
run-name: fetch npm modules
on: [push]
jobs:
  f0ck the f0cker:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:15.2
        env:
          POSTGRES_USER: f0ck
          POSTGRES_PASSWORD: f0ck
          POSTGRES_DB: f0ck
          POSTGRES_PORT: 5432
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 19
      - run: npm ci

      - name: Install PostgreSQL client
        run: |
          apt-get update
          apt-get install --yes postgresql-client

      - name: import f0ck database
        run: psql -h postgres -d f0ck -U f0ck < f0ck.sql
        env:
          PGPASSWORD: f0ck

      - name: create directories
        run: mkdir -p tmp public/ca deleted/{ca,b,t}

      - name: copy config
        run: cp config_example.json config.json
