Skip to content

Commit

Permalink
Merge pull request #836 from crowi/test-on-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sotarok committed Jul 19, 2022
2 parents a369962 + cf51758 commit 350410e
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 46 deletions.
44 changes: 0 additions & 44 deletions .circleci/config.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .env.test
@@ -0,0 +1,8 @@
PORT=3000
PASSWORD_SEED="yourpasswordseed"
MONGO_URI=
ELASTICSEARCH_URI=
REDIS_URL=redis://redis:6379
NODE_ENV="test"
SECRET_TOKEN=""
ENABLE_DNSCACHE=""
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,69 @@
name: Main

on: [push]

jobs:
run-tests:

runs-on: ubuntu-18.04
timeout-minutes: 10

strategy:
matrix:
node-version: [12.x]

services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: copy .env
run: cp .env.test .env

# https://docs.github.com/ja/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
env:
MONGOMS_DOWNLOAD_MIRROR: https://downloads.mongodb.org
MONGOMS_VERSION: 3.6.13
run: npm ci

- name: Type check
run: npm run type-check
- name: Run lint
run: npm run lint
- name: Build package
run: npm run build

# TODO: coverage
- name: Run test
run: npm run coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: coverage/clover.xml
flags: unittests
verbose: true
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -10,10 +10,9 @@
<a href="https://heroku.com/deploy?template=https://github.com/crowi/crowi/tree/v1.7.9"><img src="https://www.herokucdn.com/deploy/button.png" alt="Delpoy"></a>
</p>
<p align=center>
<a href="https://circleci.com/gh/crowi/crowi"><img src="https://circleci.com/gh/crowi/crowi.svg?style=svg" alt="Circle CI"></a>
<img src="https://github.com/crowi/crowi/actions/workflows/main.yml/badge.svg" alt="GitHub Actions CI">
<a href="https://codecov.io/gh/crowi/crowi"><img src="https://codecov.io/gh/crowi/crowi/branch/master/graph/badge.svg" alt="Codecov"></a>
<a href="https://hub.docker.com/r/crowi/crowi"><img src="https://img.shields.io/docker/pulls/crowi/crowi.svg" alt="Docker Pulls"></a>
<a href="https://spectrum.chat/crowi"><img src="https://withspectrum.github.io/badge/badge.svg" alt="Join the community on Spectrum"></a>
</p>
</div>

Expand Down

0 comments on commit 350410e

Please sign in to comment.