ci: add versions.env to unify flutter and dart versions

This commit is contained in:
Karthikeyan S 2024-02-23 19:02:21 +05:30
parent 72b5a5e8e7
commit 9876d9c90f
No known key found for this signature in database
GPG Key ID: 4F1848CCEEF73BCD
4 changed files with 20 additions and 40 deletions

View File

@ -2,15 +2,6 @@ name: "All the sdk specific jobs"
on: on:
workflow_call: workflow_call:
inputs:
flutter_version:
description: "The flutter version used for tests and builds"
type: string
required: true
dart_version:
description: "The dart version used for tests and builds"
type: string
required: true
jobs: jobs:
e2ee_test: e2ee_test:
@ -22,13 +13,14 @@ jobs:
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- name: Run tests - name: Run tests
run: | run: |
export NETWORK='--network mynet' export NETWORK='--network mynet'
docker network create mynet docker network create mynet
# deploy homeserver instance # deploy homeserver instance
scripts/integration-server-${{matrix.homeserver}}.sh scripts/integration-server-${{matrix.homeserver}}.sh
docker run $NETWORK --env GITHUB_ACTIONS="${GITHUB_ACTIONS}" --env HOMESERVER_IMPLEMENTATION="${{matrix.homeserver}}" --env HOMESERVER="${{startsWith('dendrite', matrix.homeserver) && format('{0}:8008', matrix.homeserver) || matrix.homeserver }}" --volume="$(pwd):/workdir" --workdir /workdir ghcr.io/famedly/container-image-flutter/flutter:${{inputs.flutter_version}} /bin/bash -c "set -e docker run $NETWORK --env GITHUB_ACTIONS="${GITHUB_ACTIONS}" --env HOMESERVER_IMPLEMENTATION="${{matrix.homeserver}}" --env HOMESERVER="${{startsWith('dendrite', matrix.homeserver) && format('{0}:8008', matrix.homeserver) || matrix.homeserver }}" --volume="$(pwd):/workdir" --workdir /workdir ghcr.io/famedly/container-image-flutter/flutter:${{env.flutter_version}} /bin/bash -c "set -e
scripts/integration-prepare-alpine.sh scripts/integration-prepare-alpine.sh
# create test user environment variables # create test user environment variables
source scripts/integration-create-environment-variables.sh source scripts/integration-create-environment-variables.sh
@ -42,11 +34,13 @@ jobs:
# coverage_without_olm is done on dart images because why not :D # coverage_without_olm is done on dart images because why not :D
coverage: coverage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/famedly/container-image-flutter/flutter-linux:${{inputs.flutter_version}}
options: --user root
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
flutter-version: ${{ env.flutter_version }}
cache: true
- name: Run tests - name: Run tests
run: | run: |
sed -i 's/#flutter_test/flutter_test/g' pubspec.yaml sed -i 's/#flutter_test/flutter_test/g' pubspec.yaml
@ -56,12 +50,14 @@ jobs:
coverage_without_olm: coverage_without_olm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: dart:${{inputs.dart_version}}
env: env:
NO_OLM: 1 NO_OLM: 1
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
with:
sdk: ${{ env.dart_version }}
- name: Run tests - name: Run tests
run: | run: |
apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl lcov python3 python3-distutils libsqlite3-dev apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl lcov python3 python3-distutils libsqlite3-dev
@ -71,10 +67,12 @@ jobs:
pub-dev-dry-run: pub-dev-dry-run:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: dart:${{inputs.dart_version}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
with:
sdk: ${{ env.dart_version }}
- name: pub.dev publish dry run - name: pub.dev publish dry run
run: | run: |
dart pub get dart pub get

View File

@ -13,31 +13,13 @@ concurrency:
group: ${{ github.ref }} group: ${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env:
FLUTTER_VERSION: 3.10.6
DART_VERSION: 3.0.6
jobs: jobs:
# because there is no easy way to pass env variables to jobs
versions:
runs-on: ubuntu-latest
outputs:
flutter_version: ${{ steps.flutterver.outputs.FLUTTER_VERSION }}
dart_version: ${{ steps.dartver.outputs.DART_VERSION }}
steps:
- id: flutterver
run: echo "FLUTTER_VERSION=${{ env.FLUTTER_VERSION }}" >> "$GITHUB_OUTPUT"
- id: dartver
run: echo "DART_VERSION=${{ env.DART_VERSION }}" >> "$GITHUB_OUTPUT"
dart: dart:
permissions: permissions:
contents: read contents: read
uses: famedly/frontend-ci-templates/.github/workflows/dart.yml@main uses: famedly/frontend-ci-templates/.github/workflows/dart.yml@main
needs: [versions]
with: with:
flutter_version: ${{ needs.versions.outputs.flutter_version }} env_file: ".github/workflows/versions.env"
dart_version: ${{ needs.versions.outputs.dart_version }}
secrets: secrets:
ssh_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}" ssh_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
@ -49,7 +31,3 @@ jobs:
app_jobs: app_jobs:
secrets: inherit secrets: inherit
uses: ./.github/workflows/app.yml uses: ./.github/workflows/app.yml
needs: [versions]
with:
flutter_version: ${{ needs.versions.outputs.flutter_version }}
dart_version: ${{ needs.versions.outputs.dart_version }}

View File

@ -12,3 +12,5 @@ jobs:
contents: read contents: read
id-token: write id-token: write
uses: famedly/frontend-ci-templates/.github/workflows/publish-pub.yml@main uses: famedly/frontend-ci-templates/.github/workflows/publish-pub.yml@main
with:
env_file: ".github/workflows/versions.env"

2
.github/workflows/versions.env vendored Normal file
View File

@ -0,0 +1,2 @@
flutter_version=3.10.6
dart_version=3.0.6