Skip to content

Mise jour données Agribalyse NGC-1078 #2643

Mise jour données Agribalyse NGC-1078

Mise jour données Agribalyse NGC-1078 #2643

# Generates an artifact containing the result of the `yarn compile` command.
name: Generate PR artifact
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- '!master'
jobs:
compile:
runs-on: ubuntu-22.04
outputs:
check-translation-result: ${{ steps.check-translation.outputs.result }}
check-personas-result: ${{ steps.check-personas.outputs.result }}
test-personas-nightly-result: ${{ steps.test-personas-nightly.outputs.result }}
test-personas-latest-result: ${{ steps.test-personas-latest.outputs.result }}
test-url: ${{ steps.set-test-url.outputs.fr }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --immutable
- run: git log | head && git status
- id: compilation
name: Compile
run: yarn compile
- id: check-translation
name: Checks the rules translation
run: |
yarn check:rules --markdown > check-rules.res
body="$(cat check-rules.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: check-personas
name: Checks the personas translation
run: |
yarn check:personas --markdown > check-personas.res
body="$(cat check-personas.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: test-optim
name: Test the optimized rules against base rules
run: yarn test:optim
- id: test-translation
name: Test the translated rules against production
run: yarn test:translation
- id: test-personas-latest
name: Test the personas bilans against production
run: |
yarn test:personas --markdown -v latest > test-personas-latest.res
body="$(cat test-personas-latest.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: test-personas-nightly
name: Test the personas bilans against develop
run: |
yarn test:personas --markdown -v nightly > test-personas-nightly.res
body="$(cat test-personas-nightly.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
- id: set-test-url
# Setups the NGC url with the corresponding PR number: https://nosgestesclimat.fr?PR=<pr_number>
run: echo "::set-output name=fr::${{ steps.deploy-env.outputs.name == 'master' && 'https://preprod.nosgestesclimat.fr' || format('https://preprod.nosgestesclimat.fr?PR={0}', github.event.pull_request.number) }}"
upload-artifact:
runs-on: ubuntu-22.04
needs: compile
steps:
- name: Create artifact
run: |
mkdir -p artifacts
echo "
<h1 align="center">Report for the pull request #${{ github.event.pull_request.number }}</h2>
<p align="center">:rocket: Test the model from the website: <a href=\"${{ needs.compile.outputs.test-url }}\">${{ needs.compile.outputs.test-url }}</a></p>
## :globe_with_meridians: Translation status
> _You will find more information about the translation in our [wiki](https://accelerateur-transition-ecologique-ademe.notion.site/Traduction-mod-le-5634c26ccf9b4d1e90840626227ca077?pvs=4)._
### Rules
${{ needs.compile.outputs.check-translation-result }}
### Personas
${{ needs.compile.outputs.check-personas-result }}
## :couple: Personas changes
### Test personas bilans against [preprod](https://nosgestesclimat-api.osc-fr1.scalingo.io/nightly/fr/FR/rules)
<details open=true>
<summary>In details</summary>
${{ needs.compile.outputs.test-personas-nightly-result }}
</details>
### Test personas bilans against [production](https://nosgestesclimat-api.osc-fr1.scalingo.io/latest/fr/FR/rules)
<details>
<summary>Show</summary>
${{ needs.compile.outputs.test-personas-latest-result }}
</details>
" > artifacts/result.md
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pr_message
path: artifacts