Skip to content

Commit

Permalink
feat: add a github action to run the tests (#745)
Browse files Browse the repository at this point in the history
* fix: remove unneeded files

* feat: add github action

* fix: remove warning in react useEffect

* fix: use number primitive type in TS

* feat: ajout du script pour checker les types ts

* fix: correction TS

Utilisation du type primitif number à la place du wrapper Number pour les types
Utilisation de la syntaxe ? pour les champs optionnels.

* fix: correction des tests et désactivation locale de TS

Désactivation temporaire, en attendant de savoir si on doit modifier les types (en rendant certains champs optionnels) ou si on doit modifier les tests (en ajoutant des champs qui manquent).

* feat: add type-check in CI

* fix: hidden files and dir was not removed in deploy branch
  • Loading branch information
pom421 authored Oct 11, 2021
1 parent c05db5b commit a2a4d32
Show file tree
Hide file tree
Showing 36 changed files with 159 additions and 2,401 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]

name: Install, build & test
jobs:
# As its name stands for, this jobs will install the npm dependencies and cache them
# unless they have been cached in a previous workflow run and remained unchanged.
install-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v2

- name: Cache yarn dependencies
uses: actions/cache@v2
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
# Check for `cache-hit` (`steps.cache-dependencies.cache-hit != 'true'`)
# If there's a cache hit, we skip this step (the dependencies are already available)
# If there's no cache hit, we run "yarn install"
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile --force --non-interactive
type-check:
runs-on: ubuntu-latest
needs: install-cache

steps:
- name: Checkout Commit
uses: actions/checkout@v2

# Here we use actions/cache again but this time only to restore the dependencies
# At this stage of the workflow we're sure that the dependencies have been installed and cached
# either on this same run, or on a previous CI run. Thus we can skip trying to run "yarn install".
- name: Restore yarn dependencies
uses: actions/cache@v2
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Check types
run: |
yarn type-check
unit-test:
runs-on: ubuntu-latest
needs: install-cache

steps:
- name: Checkout Commit
uses: actions/checkout@v2

- name: Restore yarn dependencies
uses: actions/cache@v2
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run test
run: yarn test

build:
runs-on: ubuntu-latest
needs: [type-check, unit-test]

steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Restore yarn dependencies
uses: actions/cache@v2
id: cache-dependencies
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build app
run: yarn build
154 changes: 0 additions & 154 deletions .gitlab-ci.yml

This file was deleted.

97 changes: 0 additions & 97 deletions .gitlab-ci/stages/01-quality.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .gitlab-ci/stages/02-prepare.yml

This file was deleted.

Loading

0 comments on commit a2a4d32

Please sign in to comment.