From 7034d7d713a0c0c2f9826705b026b0d75f44ee2f Mon Sep 17 00:00:00 2001 From: Lingyong Sun Date: Tue, 21 Jan 2025 20:29:46 +0100 Subject: [PATCH 1/2] LYS-20 upload unit test results and code coverage to pages upload unit test results and code coverage to artifact download artifacts add links in README.md --- .github/workflows/deploy.yaml | 12 +++++++++++- .github/workflows/test.yaml | 12 ++++++++++++ README.md | 6 +++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3c75539..c1277d8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,7 +3,7 @@ name: Deploy photos on: push: branches: - - LYS-20-rilasciare-la-sottosezione-risultati-bdd + - LYS-21-rilasciare-la-sottosezione-risultati-unittest-e-coverage # - master jobs: @@ -73,6 +73,16 @@ jobs: with: name: bdd path: bdd + - name: Download unit tests reports + uses: actions/download-artifact@v4 + with: + name: unit + path: unit + - name: Download code coverage reports + uses: actions/download-artifact@v4 + with: + name: coverage + path: coverage - name: Deploy pages uses: peaceiris/actions-gh-pages@v4 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4e01bb1..4942c65 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,6 +18,18 @@ jobs: run: npm ci - name: Run Unit tests with coverage run: npm run test:unit + - name: Upload unit tests results to artifacts + uses: actions/upload-artifact@v4 + with: + name: unit + path: .reports/unit + if-no-files-found: error + - name: Upload code coverage to artifacts + uses: actions/upload-artifact@v4 + with: + name: coverage + path: .reports/coverage + if-no-files-found: error - name: Run Bdd run: npm run test:bdd - name: Upload Bdd test results to artifacts diff --git a/README.md b/README.md index 4b365e9..16e7b6c 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,8 @@ master deploy status [![photos](https://github.com/lysz210/photos/actions/workfl # Test results -[Bdd results](https://lysz210.github.io/photos/bdd) \ No newline at end of file +[Bdd results](https://lysz210.github.io/photos/bdd) + +[Unit tests results](https://lysz210.github.io/photos/unit) + +[Code coverage](https://lysz210.github.io/photos/coverage) \ No newline at end of file From 5f9721c724d0d83da1f49bd8d574923fdc82abb0 Mon Sep 17 00:00:00 2001 From: Lingyong Sun Date: Tue, 21 Jan 2025 20:35:41 +0100 Subject: [PATCH 2/2] LYS-21 upload unit test results and code coverage to pages --- .github/workflows/deploy.yaml | 55 +++++++++++++++++------------------ .github/workflows/test.yaml | 2 +- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c1277d8..7a50753 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,37 +3,36 @@ name: Deploy photos on: push: branches: - - LYS-21-rilasciare-la-sottosezione-risultati-unittest-e-coverage -# - master + - master jobs: tests: uses: ./.github/workflows/test.yaml -# deploy: -# needs: -# - tests -# runs-on: ${{ matrix.os }} -# strategy: -# matrix: -# os: [ ubuntu-latest ] -# node: [ 22 ] -# steps: -# - uses: actions/checkout@v4 -# # todo build steps -# # deploy -# - name: Pulumi dependencies -# working-directory: pulumi -# run: npm ci -# - uses: pulumi/actions@v6 -# with: -# command: up -# stack-name: lysz210/photos/dev -# work-dir: pulumi -# env: -# PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} -# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} -# AWS_REGION: ${{ secrets.AWS_REGION }} -# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + deploy: + needs: + - tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + node: [ 22 ] + steps: + - uses: actions/checkout@v4 + # todo build steps + # deploy + - name: Pulumi dependencies + working-directory: pulumi + run: npm ci + - uses: pulumi/actions@v6 + with: + command: up + stack-name: lysz210/photos/dev + work-dir: pulumi + env: + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} docs: needs: - tests @@ -52,7 +51,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: docs - path: ${{ github.workspace }}/.reports/docs + path: .reports/docs if-no-files-found: error pages: needs: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4942c65..4ad9213 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,5 +36,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: bdd - path: ${{ github.workspace }}/.reports/bdd + path: .reports/bdd if-no-files-found: error \ No newline at end of file