diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 77d24bc..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: SQLite CI - -on: - push: - branches: - - master - pull_request: - -jobs: - test: - name: Run Tests with SQLite - runs-on: ubuntu-latest - - steps: - # Initialization - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install - - name: Run Tests - timeout-minutes: 5 - run: npm test diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml deleted file mode 100644 index db6e99e..0000000 --- a/.github/workflows/codecov.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Codecov - -on: - push: - branches: - - master - pull_request: - -jobs: - codecov: - name: Run Codecov - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the docker-compose stack - env: - PG_USER: ci_db_user - PG_PASS: ci_db_pass - run: docker-compose -f docker/docker-compose-ci.yml up -d - - name: Check running containers - run: docker ps - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm ci - - name: Generate sqlite coverage reports - run: npx nyc --reporter=lcov npm test - - name: Generate postgres coverage reports - env: - TEST_POSTGRES: true - timeout-minutes: 5 - run: npx nyc --reporter=lcov npm test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index ce37e1e..2485108 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -22,8 +22,7 @@ jobs: permissions: packages: write steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Docker meta id: meta uses: docker/metadata-action@v4 diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml deleted file mode 100644 index 02902c1..0000000 --- a/.github/workflows/eslint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Linting - -on: - push: - branches: - - master - pull_request: - -jobs: - lint: - name: Lint with ESLint - runs-on: ubuntu-latest - - steps: - # Initialization - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install - - name: Run Tests - timeout-minutes: 5 - run: npm run lint \ No newline at end of file diff --git a/.github/workflows/generate-sqlite-base.yml b/.github/workflows/generate-sqlite-base.yml index f4bcf06..3893cd0 100644 --- a/.github/workflows/generate-sqlite-base.yml +++ b/.github/workflows/generate-sqlite-base.yml @@ -18,7 +18,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - run: npm install + cache: npm + - run: npm ci - name: Set config run: | echo '{"mode": "init-db-and-exit"}' > config.json diff --git a/.github/workflows/postgres-redis-ci.yml b/.github/workflows/postgres-redis-ci.yml deleted file mode 100644 index 3003686..0000000 --- a/.github/workflows/postgres-redis-ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: PostgreSQL + Redis CI - -on: - push: - branches: - - master - pull_request: - -jobs: - test: - name: Run Tests with PostgreSQL and Redis - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the docker-compose stack - env: - PG_USER: ci_db_user - PG_PASS: ci_db_pass - run: docker-compose -f docker/docker-compose-ci.yml up -d - - name: Check running containers - run: docker ps - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install - - name: Run Tests - env: - TEST_POSTGRES: true - timeout-minutes: 5 - run: npx nyc --silent npm test \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..2062d5c --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,116 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + lint-build: + name: Lint with ESLint and build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - run: npm ci + - run: npm run lint + - run: npm run tsc + - name: cache dist build + uses: actions/cache/save@v3 + with: + key: dist-${{ github.sha }} + path: | + ${{ github.workspace }}/dist + ${{ github.workspace }}/node_modules + test-sqlite: + name: Run Tests with SQLite + runs-on: ubuntu-latest + needs: lint-build + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - id: cache + uses: actions/cache/restore@v3 + with: + key: dist-${{ github.sha }} + path: | + ${{ github.workspace }}/dist + ${{ github.workspace }}/node_modules + - if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + - name: Run SQLite Tests + timeout-minutes: 5 + run: npx nyc --silent npm test + - name: cache nyc output + uses: actions/cache/save@v3 + with: + key: nyc-sqlite-${{ github.sha }} + path: ${{ github.workspace }}/.nyc_output + test-postgres: + name: Run Tests with PostgreSQL and Redis + runs-on: ubuntu-latest + needs: lint-build + steps: + - uses: actions/checkout@v3 + - name: Build the docker-compose stack + env: + PG_USER: ci_db_user + PG_PASS: ci_db_pass + run: docker-compose -f docker/docker-compose-ci.yml up -d + - name: Check running containers + run: docker ps + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - id: cache + uses: actions/cache/restore@v3 + with: + key: dist-${{ github.sha }} + path: | + ${{ github.workspace }}/dist + ${{ github.workspace }}/node_modules + - if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + - name: Run Postgres Tests + env: + TEST_POSTGRES: true + timeout-minutes: 5 + run: npx nyc --silent npm test + - name: cache nyc output + uses: actions/cache/save@v3 + with: + key: nyc-postgres-${{ github.sha }} + path: ${{ github.workspace }}/.nyc_output + codecov: + needs: [test-sqlite, test-postgres] + name: Run Codecov + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - run: npm ci + - name: restore postgres nyc output + uses: actions/cache/restore@v3 + with: + key: nyc-postgres-${{ github.sha }} + path: ${{ github.workspace }}/.nyc_output + - name: restore sqlite nyc output + uses: actions/cache/restore@v3 + with: + key: nyc-sqlite-${{ github.sha }} + path: ${{ github.workspace }}/.nyc_output + - run: npx nyc report --reporter=lcov + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3