diff --git a/.github/workflows/create_docker_image.yml b/.github/workflows/create_docker_image.yml index 093629a53bc..9c6559ebc3c 100644 --- a/.github/workflows/create_docker_image.yml +++ b/.github/workflows/create_docker_image.yml @@ -22,6 +22,9 @@ jobs: create_image: runs-on: ubuntu-latest + env: + UNIT_TEST_REPORT_FILE: './unit-tests.log' + steps: - name: Checkout uses: actions/checkout@v4 @@ -35,24 +38,41 @@ jobs: - name: Install JS dependencies run: yarn --immutable + - name: Set short sha + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Test run: | set -o pipefail - yarn test --coverage --coverage-reporters=lcov --detectOpenHandles=false 2>&1 | tee ./unit-tests.log + yarn test --coverage --coverage-reporters=lcov --detectOpenHandles=false 2>&1 | tee ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "RELEASE TAG = ${{ inputs.tag }}" >> ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "SHORT COMMIT SHA = ${{ steps.vars.outputs.sha_short }}" >> ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "TEST RUN DATE = $(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${{ env.UNIT_TEST_REPORT_FILE }} - name: Build run: yarn build:prod - - name: Set short sha - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Push Docker image env: DOCKER_PASSWORD: ${{secrets.WEBTEAM_QUAY_PASSWORD}} DOCKER_USERNAME: ${{secrets.WEBTEAM_QUAY_USERNAME}} run: yarn docker "${{inputs.tag}}-${{ steps.vars.outputs.sha_short }}" + - name: Install AWS CLI + run: | + sudo apt-get update + sudo apt-get install -y awscli + + - name: Upload unit-tests.log to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: eu-west-1 + run: | + TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ') + aws s3 cp ${{ env.UNIT_TEST_REPORT_FILE }} s3://wire-webapp/unit-tests-release-${{ inputs.tag }}-${TIMESTAMP}-${{ steps.vars.outputs.sha_short }}.log + - name: Create GitHub release if: ${{inputs.create_release}} id: create_release_production @@ -62,6 +82,6 @@ jobs: with: tag_name: ${{inputs.tag}} name: ${{inputs.tag}} - files: ./unit-tests.log + files: ${{ env.UNIT_TEST_REPORT_FILE }} draft: false prerelease: true diff --git a/.github/workflows/generate_test_report.yml b/.github/workflows/generate_test_report.yml index e8fd0818337..30e9d3be72c 100644 --- a/.github/workflows/generate_test_report.yml +++ b/.github/workflows/generate_test_report.yml @@ -12,6 +12,9 @@ jobs: generate_test_report: runs-on: ubuntu-latest + env: + UNIT_TEST_REPORT_FILE: './unit-tests.log' + steps: - name: Checkout uses: actions/checkout@v4.1.6 @@ -45,14 +48,20 @@ jobs: - name: Test run: | set -o pipefail - yarn test --coverage --coverage_reporters=lcov 2>&1 | tee ./unit-tests.log + yarn test --coverage --coverage_reporters=lcov 2>&1 | tee ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "COMMIT SHA = ${{ inputs.commit }}" >> ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "TEST RUN DATE = $(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${{ env.UNIT_TEST_REPORT_FILE }} - - name: Print environment variables + - name: Install AWS CLI run: | - echo -e "COMMIT SHA = ${{ inputs.commit }}" >> ./unit-tests.log + sudo apt-get update + sudo apt-get install -y awscli - - name: Save test coverage results - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: ./unit-tests.log + - name: Upload unit-tests.log to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: eu-west-1 + run: | + TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ') + aws s3 cp ${{ env.UNIT_TEST_REPORT_FILE }} s3://wire-webapp/unit-tests-${TIMESTAMP}-${{ inputs.commit }}.log diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index da2ba663bf3..e049977bee1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -65,12 +65,28 @@ jobs: run: | set -o pipefail yarn test --detectOpenHandles=false 2>&1 | tee ${{ env.UNIT_TEST_REPORT_FILE }} + echo -e "COMMIT SHA = ${{ github.sha }}" >> ${{env.UNIT_TEST_REPORT_FILE}} + echo -e "TEST RUN DATE = $(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${{env.UNIT_TEST_REPORT_FILE}} - uses: actions/upload-artifact@v4 with: name: 'unit-tests-report' path: ${{env.UNIT_TEST_REPORT_FILE}} + - name: Install AWS CLI + run: | + sudo apt-get update + sudo apt-get install -y awscli + + - name: Upload unit-tests.log to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: eu-west-1 + run: | + TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ') + aws s3 cp ${{env.UNIT_TEST_REPORT_FILE}} s3://wire-webapp/unit-tests-${TIMESTAMP}-${{ github.sha }}.log + - name: Build run: yarn build:prod