Refactoring #214
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trevas TS CI | |
on: [push, pull_request] | |
jobs: | |
test-build: | |
name: Test & build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- run: yarn | |
# Build modules | |
- run: yarn build | |
# Build sonar reports | |
- run: yarn test --coverage | |
- name: Upload deploy artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage/ | |
sonarcloud: | |
runs-on: ubuntu-latest | |
needs: test-build | |
if: (github.repository == 'InseeFr/Trevas-TS' && ( | |
github.event_name == 'push') || ( | |
github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.fork == false | |
)) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
path: coverage | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
build-assets: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
needs: sonarcloud | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- run: yarn | |
# Build modules | |
- run: yarn build | |
# Build Storybook | |
- run: yarn build-storybook | |
- run: mkdir -p deploy/storybook | |
- run: cp -R ./storybook-static. ./deploy/storybook | |
# Build documentation | |
- run: | | |
yarn install --frozen-lockfile | |
yarn build | |
working-directory: ./docs/ | |
- run: mkdir -p deploy/docs | |
- run: cp -R ./docs/build/. ./deploy/docs | |
- name: Upload deploy artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deploy | |
path: deploy/ | |
deploy: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
needs: build-assets | |
steps: | |
- name: Download deploy artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: . |