3.2.11 #1510
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: Continous Integration Workflow | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js 18.x | |
uses: actions/setup-node@master | |
with: | |
node-version: 18.x | |
- name: Node modules cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Install the dependencies | |
run: npm ci | |
- name: Build the bundle for testing | |
run: npm run build | |
env: | |
PUBLIC_URL: / | |
REACT_APP_ENABLE_LANG_OVERRIDE: false | |
- name: Serve the application | |
run: npm run serve & | |
- name: Run the Venus simulation | |
run: > | |
docker run -d --rm -p 9001:9001 -p 1883:1883 -p 3000:3000 -p 8080:80 | |
--name venus-docker victronenergy/venus-docker:latest | |
/root/run_with_simulation.sh z | |
- name: Run unit and E2E tests | |
run: npm run test:ci || exit 0 | |
- name: Generate E2E Report | |
run: npm run generate-e2e-report | |
if: always() | |
- name: Upload E2E Results | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: e2e-tests-results | |
path: cypress/results/results.json | |
- name: Upload E2E Report | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: e2e-tests-report | |
path: cypress/report | |
- name: Upload Cypress Screenshots | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Upload Cypress Videos | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos | |
- name: Check Tag | |
id: check_tag | |
run: | | |
if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo ::set-output name=match::true | |
fi | |
- name: Build the production bundle | |
if: steps.check_tag.outputs.match == 'true' | |
run: npm run build | |
env: | |
PUBLIC_URL: /app | |
REACT_APP_ENABLE_LANG_OVERRIDE: false | |
- name: Archive bundle | |
if: steps.check_tag.outputs.match == 'true' | |
run: tar -zcvf venus-html5-app.tar.gz dist/ | |
- name: Create Release | |
id: create_release | |
if: steps.check_tag.outputs.match == 'true' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
- name: Upload Release Archive | |
if: steps.check_tag.outputs.match == 'true' | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./venus-html5-app.tar.gz | |
asset_name: venus-html5-app.tar.gz | |
asset_content_type: application/zip |