From dea466668a2a10ed68c5c3d9d60790b648496c17 Mon Sep 17 00:00:00 2001 From: Raido Kaju Date: Wed, 14 Feb 2024 17:17:24 +0200 Subject: [PATCH] chore: update GitHub actions and include Focal build and RHEL builds --- .github/workflows/run_tests.yaml | 57 +++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 722e01f7d6..c31259ea62 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -15,31 +15,40 @@ on: - 'src/**' - '.github/**' - 'ansible/**' +permissions: + contents: write # Required for https://github.com/gradle/actions/tree/main/setup-gradle#github-dependency-graph-support + pull-requests: write # https://github.com/gradle/actions/tree/main/setup-gradle#adding-job-summary-as-a-pull-request-comment + actions: read # Required for https://github.com/dorny/test-reporter + checks: write # Required for https://github.com/dorny/test-reporter jobs: BuildAndPackageWithUnitTests: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # SonarCloud: Shallow clones should be disabled for a better relevancy of analysis - name: Ensure required packages + env: + DEBIAN_FRONTEND: noninteractive # Less output to log run: sudo apt-get update && sudo apt-get install -y curl software-properties-common build-essential unzip debhelper devscripts - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' }} gradle-home-cache-cleanup: true + dependency-graph: generate-and-submit + add-job-summary-as-pr-comment: always - name: Build and test source env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -58,36 +67,47 @@ jobs: reporter: java-junit list-suites: 'failed' list-tests: 'failed' + - name: Build RHEL7 packages + run: docker build -t rhel7 ${{ github.workspace }}/src/packages/docker/rpm/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel7 ./src/packages/build-rpm.sh + - name: Build RHEL8 packages + run: docker build -t rhel8 ${{ github.workspace }}/src/packages/docker/rpm-el8/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel8 ./src/packages/build-rpm.sh + - name: Build RHEL9 packages + run: docker build -t rhel9 ${{ github.workspace }}/src/packages/docker/rpm-el9/ && docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v ${{ github.workspace }}:/workspace rhel9 ./src/packages/build-rpm.sh + - name: Build Focal packages + env: + DEBEMAIL: 'info@niis.org' + DEBFULLNAME: 'NIIS' + run: ./src/packages/build-deb.sh focal - name: Build Jammy packages env: DEBEMAIL: 'info@niis.org' DEBFULLNAME: 'NIIS' run: ./src/packages/build-deb.sh jammy -release - name: Store deb files for system tests - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: debian-packages path: src/packages/build/ubuntu22.04/*.deb + compression-level: 0 #No point in compressing these RunCSSystemTests: needs: BuildAndpackageWithUnitTests runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: - cache-read-only: ${{ github.ref != 'refs/heads/develop' }} - gradle-home-cache-cleanup: true + cache-read-only: true - name: Initialize docker setup working-directory: ./.github/docker/centralserver run: ./init_context.sh - name: Download debian packages - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: debian-packages path: ./.github/docker/centralserver/build/packages/develop/debian @@ -107,7 +127,7 @@ jobs: reporter: java-junit - name: Upload CS screenshots if: failure() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: CS System Test screenshots path: src/central-server/admin-service/ui-system-test/build/reports/test-automation/selenide-failures/*.png @@ -115,19 +135,18 @@ jobs: needs: BuildAndpackageWithUnitTests runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 with: - cache-read-only: ${{ github.ref != 'refs/heads/develop' }} - gradle-home-cache-cleanup: true + cache-read-only: true - name: Download debian packages - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: debian-packages path: ./src/security-server/system-test/src/intTest/resources/container-files/packages/develop/debian @@ -147,7 +166,7 @@ jobs: run: sudo chown -R $USER src/security-server/system-test/build/ss-container-logs/ if: failure() - name: Upload SS report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: SS System Test report