From 6387740d66a4cbfdd05e3ef21546553b0d92a586 Mon Sep 17 00:00:00 2001 From: Adi Mizrahi Date: Mon, 27 Jan 2025 08:10:59 +0200 Subject: [PATCH 1/2] Add github actions script --- .github/workflows/cloudinary_dart.yml | 47 +++++++++++++++++++++++++++ .travis.yml | 17 ---------- 2 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/cloudinary_dart.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/cloudinary_dart.yml b/.github/workflows/cloudinary_dart.yml new file mode 100644 index 00000000..fd7ff415 --- /dev/null +++ b/.github/workflows/cloudinary_dart.yml @@ -0,0 +1,47 @@ +name: Cloudinary Dart CI + +on: + push: + branches: + - master # Runs on pushes to the main branch + pull_request: + branches: + - '**' # Runs on all pull requests + +jobs: + dart-test: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the code + - name: Checkout Code + uses: actions/checkout@v3 + + # Step 2: Set up Dart + - name: Setup Dart + uses: dart-lang/setup-dart@v1 + with: + channel: stable # Use the stable Dart SDK version + + # Step 3: Export Cloudinary URL (Before Script) + - name: Export Cloudinary URL + run: export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh) + + # Step 4: Run Tests for url_gen + - name: Run Tests for url_gen + working-directory: url_gen + run: dart test + + # Step 5: Run Tests for api + - name: Run Tests for api + working-directory: api + run: dart test + + # Cache Dart Dependencies + - name: Cache Pub Dependencies + uses: actions/cache@v3 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.yaml') }} + restore-keys: | + ${{ runner.os }}-pub-cache- diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d54c37f0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -os: - - linux -sudo: false -language: dart -dart: - - stable - -before_script: export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh); -script: - - cd url_gen - - dart test - - cd .. - - cd api - - dart test -cache: - directories: - - $HOME/.pub-cache \ No newline at end of file From e1340e865bc02d5f11a554aeefedd207db6c19f1 Mon Sep 17 00:00:00 2001 From: Adi Mizrahi Date: Mon, 27 Jan 2025 08:14:32 +0200 Subject: [PATCH 2/2] Fix script --- .github/workflows/cloudinary_dart.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cloudinary_dart.yml b/.github/workflows/cloudinary_dart.yml index fd7ff415..e32dbb86 100644 --- a/.github/workflows/cloudinary_dart.yml +++ b/.github/workflows/cloudinary_dart.yml @@ -3,10 +3,10 @@ name: Cloudinary Dart CI on: push: branches: - - master # Runs on pushes to the main branch + - main pull_request: branches: - - '**' # Runs on all pull requests + - '**' jobs: dart-test: @@ -21,20 +21,24 @@ jobs: - name: Setup Dart uses: dart-lang/setup-dart@v1 with: - channel: stable # Use the stable Dart SDK version + channel: stable # Step 3: Export Cloudinary URL (Before Script) - name: Export Cloudinary URL - run: export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh) + run: echo "CLOUDINARY_URL=$(bash tools/get_test_cloud.sh)" >> $GITHUB_ENV # Step 4: Run Tests for url_gen - name: Run Tests for url_gen working-directory: url_gen + env: + CLOUDINARY_URL: ${{ env.CLOUDINARY_URL }} run: dart test # Step 5: Run Tests for api - name: Run Tests for api working-directory: api + env: + CLOUDINARY_URL: ${{ env.CLOUDINARY_URL }} run: dart test # Cache Dart Dependencies