Skip to content

feat(repo): output env to build #24

feat(repo): output env to build

feat(repo): output env to build #24

Workflow file for this run

name: pr e2e test
on:
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
e2e-test:
name: e2e-test
runs-on: ubuntu-latest
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.26
env:
discovery.type: single-node
options:
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 30s
--health-retries 10
ports:
- 9200:9200
mongodb:
image: mongo
ports:
- 27017:27017
options: >-
--health-cmd mongosh
--health-interval 10s
--health-timeout 5s
--health-retries 5
volumes:
- db_vol:/data/db
steps:
- uses: actions/checkout@v4
- name: Setup mongodb-tools
run: |
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
sudo apt install ./mongodb-database-tools-*-100.6.1.deb
- run: mongoimport test/heroes.json # TODO find a way to run this inside the mongo service container, then the `Setup mongodb-tools` would not be needed neither
- name: Create es index
run: curl -X PUT localhost:9200/heroes
- name: Update index to have 0 replicas # TODO es create 1 repl set per node by default, index status is yellow.
run: |
curl -X PUT http://localhost:9200/heroes/_settings -H "Content-Type: application/json" -d '{
"index" : {
"number_of_replicas" : 0
}
}'
- name: Inject data into es
run: |
curl -X PUT http://localhost:9200/heroes/_create/1 -H "Content-Type: application/json" -d @test/heroes.json
- name: Install dependencies
run: npm i
- name: Build app
run: npm run build:coverage
- name: Install Playwright Browsers and dependencies
run: npx playwright install --with-deps
- name: Run Playwright tests
run: COVERAGE=true npm run test:playwright
- name: Upload playwright blob report to Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: blob-report
path: blob-report
retention-days: 30
- name: Upload nyc report row data to Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e_nyc_output
path: e2e_nyc_output
retention-days: 30
- name: Upload current run allure result to Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: allure-results
path: allure-results
retention-days: 30
- name: Upload error log to Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: error.log
path: error.log
retention-days: 30
publish-playwright-report:
name: Publish playwright report
needs: [ e2e-test ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: generate playwright report
uses: ./.github/actions/generate-playwright-report
- name: Upload playwright report to Azure
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az storage blob upload-batch --account-name mysimplewebsite -s ./playwright-report -d playwright --destination-path ${{github.event.pull_request.number}} --overwrite
- name: Populate playwright report to summary
run: |
echo "# Deployed playwright report to https://mysimplewebsite.blob.core.windows.net/playwright/${{github.event.pull_request.number}}/index.html" >> $GITHUB_STEP_SUMMARY
publish-playwright-coverage-html-report:
name: Publish playwright coverage report
needs: [ e2e-test ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: generate playwright coverage report
uses: ./.github/actions/generate-playwright-coverage-report
- name: Upload playwright coverage report to Azure
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az storage blob upload-batch --account-name mysimplewebsite -s ./coverage-e2e -d playwright-coverage --destination-path ${{github.event.pull_request.number}} --overwrite
- name: Populate coverage report to job summary
run: |
echo "# Deployed playwright coverage report to https://mysimplewebsite.blob.core.windows.net/playwright-coverage/${{github.event.pull_request.number}}/lcov-report/index.html" >> $GITHUB_STEP_SUMMARY
publish-allure-report:
name: Publish allure report
needs: [ e2e-test ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: npm i
- name: Setup JDK
uses: actions/[email protected]
with:
distribution: 'microsoft'
java-version: '21'
- name: Azure Login
uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: generate allure report
uses: ./.github/actions/generate-allure-report
- name: Upload allure report to Azure
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az storage blob upload-batch --account-name mysimplewebsite -s ./allure-report -d allure-report --overwrite
- name: Populate allure report to job summary
shell: bash
run: |
echo "# Deployed allure report to https://mysimplewebsite.blob.core.windows.net/allure-report/index.html" >> $GITHUB_STEP_SUMMARY