|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2025 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | + |
| 14 | +name: Execute Unit Tests |
| 15 | +on: |
| 16 | + workflow_dispatch: |
| 17 | + pull_request: |
| 18 | + release: |
| 19 | + types: [created] |
| 20 | + schedule: |
| 21 | + - cron: '30 3 * * *' # Every night at 03:30 UTC on main branch |
| 22 | +jobs: |
| 23 | + integration_test: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Show disk space before build |
| 27 | + run: | |
| 28 | + echo 'Disk space before build:' |
| 29 | + df -h |
| 30 | +
|
| 31 | + - name: Removing unneeded software |
| 32 | + run: | |
| 33 | + echo "Removing unneeded software... " |
| 34 | + if [ -d /usr/share/dotnet ]; then echo "Removing dotnet..."; start=$(date +%s); sudo rm -rf /usr/share/dotnet; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 35 | + #if [ -d /usr/local/lib/android ]; then echo "Removing android..."; start=$(date +%s); sudo rm -rf /usr/local/lib/android; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 36 | + if [ -d /opt/ghc ]; then echo "Removing haskell (ghc)..."; start=$(date +%s); sudo rm -rf /opt/ghc; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 37 | + if [ -d /usr/local/.ghcup ]; then echo "Removing haskell (ghcup)..."; start=$(date +%s); sudo rm -rf /usr/local/.ghcup; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 38 | + if [ -d /usr/share/swift ]; then echo "Removing swift..."; start=$(date +%s); sudo rm -rf /usr/share/swift; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 39 | + if [ -d /usr/local/share/chromium ]; then echo "Removing chromium..."; start=$(date +%s); sudo rm -rf /usr/local/share/chromium; end=$(date +%s); echo "Duration: $((end-start))s"; fi |
| 40 | +
|
| 41 | + - name: Show disk space after cleanup |
| 42 | + run: | |
| 43 | + echo 'Disk space after cleanup:' |
| 44 | + df -h |
| 45 | +
|
| 46 | + - name: Checkout repository |
| 47 | + |
| 48 | + |
| 49 | + - name: Setup Bazel |
| 50 | + uses: bazel-contrib/[email protected] |
| 51 | + with: |
| 52 | + bazelisk-cache: true |
| 53 | + disk-cache: ${{ github.workflow }} |
| 54 | + repository-cache: true |
| 55 | + |
| 56 | + - name: Bazel build targets |
| 57 | + run: | |
| 58 | + scripts/run_unit_tests.sh |
| 59 | + cat _logs/ut_summary.md |
| 60 | +
|
| 61 | + - name: Publish build summary |
| 62 | + if: always() |
| 63 | + run: | |
| 64 | + if [ -f _logs/ut_summary.md ]; then |
| 65 | + cat _logs/ut_summary.md >> "$GITHUB_STEP_SUMMARY" |
| 66 | + else |
| 67 | + echo "No build summary file found (_logs/ut_summary.md)" >> "$GITHUB_STEP_SUMMARY" |
| 68 | + fi |
| 69 | +
|
| 70 | + - name: Upload logs artifact |
| 71 | + if: always() |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: bazel-build-logs |
| 75 | + path: _logs/ |
| 76 | + if-no-files-found: warn |
| 77 | + retention-days: 14 |
| 78 | + |
| 79 | + - name: Create archive of test reports |
| 80 | + if: github.ref_type == 'tag' |
| 81 | + run: | |
| 82 | + mkdir -p artifacts |
| 83 | + find bazel-testlogs/external -name 'test.xml' -print0 | xargs -0 -I{} cp --parents {} artifacts/ |
| 84 | + zip -r ${{ github.event.repository.name }}_test_reports.zip artifacts/ |
| 85 | + shell: bash |
| 86 | + |
| 87 | + - name: Upload release asset (attach ZIP to GitHub Release) |
| 88 | + |
| 89 | + if: github.ref_type == 'tag' |
| 90 | + with: |
| 91 | + files: ${{ github.event.repository.name }}_test_reports.zip |
| 92 | + env: |
| 93 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments