From 61ac921032549a010f1a6a6852bed4415f97b40a Mon Sep 17 00:00:00 2001 From: EduardGomezEscandell Date: Thu, 5 Oct 2023 11:00:03 +0200 Subject: [PATCH] Track flutter version in a file --- .github/actions/load-json/action.yaml | 29 +++++++++++++++++++++++++++ .github/workflows/qa-azure.yaml | 10 ++++++--- .github/workflows/qa.yaml | 17 +++++++++++----- tools/versions.json | 4 ++++ 4 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 .github/actions/load-json/action.yaml create mode 100644 tools/versions.json diff --git a/.github/actions/load-json/action.yaml b/.github/actions/load-json/action.yaml new file mode 100644 index 000000000..688a90832 --- /dev/null +++ b/.github/actions/load-json/action.yaml @@ -0,0 +1,29 @@ +name: Load JSON +description: Loads JSON data from a file. + +inputs: + path: + required: true + description: "Path to the JSON file" + +outputs: + data: + description: "Loaded data. Can be accessed like a Github matrix." + value: ${{ fromJson(steps.load.outputs.data) }} + +runs: + using: "composite" + steps: + - name: Load JSON + id: load + shell: bash + run : | + # Load JSON from ${{ inputs.path }} + set -eu + data=$(cat '${{ inputs.path }}') + + # Remove endlines + data="${data//[$'\r\n']}" + + # Store result (must be in a single line) + echo "versions='$data'" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/qa-azure.yaml b/.github/workflows/qa-azure.yaml index b23cacfaf..9725c660d 100644 --- a/.github/workflows/qa-azure.yaml +++ b/.github/workflows/qa-azure.yaml @@ -12,7 +12,6 @@ on: env: az_name: wsl-ci-3 az_resource_group: wsl - flutter-version: 3.13.x jobs: build-wsl-pro-service: @@ -43,10 +42,15 @@ jobs: - uses: actions/setup-go@v4 with: go-version-file: go.work + - name: Load flutter version + id: load + uses: ./.github/actions/load-json + with: + path: tools/versions.json - uses: subosito/flutter-action@v2 with: channel: stable - flutter-version: ${{ env.flutter-version }} + flutter-version: ${{ steps.load.outputs.data.flutter-version }} - name: Setup MSBuild (PATH) uses: microsoft/setup-msbuild@v1.3.1 - name: Install certificate @@ -170,7 +174,7 @@ jobs: # Uninstall Appx Get-AppxPackage -Name "CanonicalGroupLimited.UbuntuProForWindows" | Remove-AppxPackage -ErrorAction Ignore - + # Uninstall certificate $thumbprint = (Get-PfxCertificate -FilePath "ci-artifacts\windows-agent\UbuntuProForWindows_*.cer").Thumbprint Remove-Item -Path "Cert:LocalMachine\TrustedPeople\${thumbprint}" diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index a8c878969..220e56e62 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -10,9 +10,6 @@ concurrency: group: QA-${{ github.head_ref || github.run_id }} cancel-in-progress: true -env: - flutter-version: 3.13.x - jobs: quality-go: name: "Go Quality checks" @@ -118,10 +115,15 @@ jobs: uses: actions/setup-go@v4 with: go-version-file: windows-agent/go.mod + - name: Load flutter version + id: load + uses: ./.github/actions/load-json + with: + path: tools/versions.json - name: Flutter QA uses: ./.github/actions/flutter-qa/ with: - flutter-version: ${{ env.flutter-version }} + flutter-version: ${{ steps.load.outputs.data.flutter-version }} package-dir: '${{ matrix.package }}' run-build-runner: ${{ contains(matrix.package, 'ubuntupro') }} - uses: ./.github/actions/check-diff @@ -151,10 +153,15 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev unzip xvfb - name: Check out repository uses: actions/checkout@v4 + - name: Load flutter version + id: load + uses: ./.github/actions/load-json + with: + path: tools/versions.json - name: Flutter QA uses: ./.github/actions/flutter-integration-test/ with: - flutter-version: ${{ env.flutter-version }} + flutter-version: ${{ steps.load.outputs.data.flutter-version }} go-version-file: windows-agent/go.mod # Only the app entry point is expected to have integration tests package-dir: 'gui/packages/ubuntupro' diff --git a/tools/versions.json b/tools/versions.json new file mode 100644 index 000000000..eb2112b4f --- /dev/null +++ b/tools/versions.json @@ -0,0 +1,4 @@ +{ + "doc": "This doument is used by the CI to track versions that cannot be tracked by Go.", + "flutter-version": "3.13.x" +} \ No newline at end of file