Skip to content

Commit

Permalink
run generated dart tests
Browse files Browse the repository at this point in the history
  • Loading branch information
humblerookie committed Jun 17, 2024
1 parent 9f90307 commit e34aea3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/dart-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Dart Tests
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.4.0
- name: Cache Dart dependencies
uses: actions/cache@v2
with:
path: ~/.pub-cache
key: ${{ runner.os }}-dart-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-dart-
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # Runs 'bundle install' and caches installed gems automatically
- name: Generate Dart Code & Run Tests
run: bundle exec rake test_dart
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ task :test_kotlin do
end
end

desc "Generates dart source code and run its unit tests."
task :test_dart do
config_file = File.absolute_path("spec/fixtures/dart-tests.yml")
dotenv_file = File.absolute_path("spec/fixtures/.env.fruitloops")
directory_to_copy = File.absolute_path("spec/fixtures/dart")
with_temp_dir do |temp_dir|
puts "Current working directory: #{temp_dir}"
FileUtils.copy_entry(directory_to_copy, "tests")
Dir.chdir("tests")
sh("ARKANA_RUNNING_CI_INTEGRATION_TESTS=true && arkana --lang dart --config-filepath #{config_file} --dotenv-filepath #{dotenv_file} --include-environments dev,staging")
sh("dart test")
end
end

desc "Sets lib version to the semantic version given, and push it to remote."
task :bump, [:v] do |_t, args|
version = args[:v] || raise("A version is required. Pass it like `rake bump[1.2.3]`")
Expand Down
32 changes: 32 additions & 0 deletions spec/fixtures/dart-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import_name: 'MySecrets'
namespace: 'MySecrets'
result_path: 'tests'
should_generate_unit_tests: true
global_secrets:
- BoolAsStringTrueKey
- BoolAsStringFalseKey
- BoolAsBoolTrueKey
- BoolAsBoolFalseKey
- IntAsStringKey
- IntAsNumberKey
- IntWithLeadingZeroesAsStringKey
- IntWithLeadingZeroesAsNumberKey
- MassiveIntAsStringKey
- MassiveIntAsNumberKey
- NegativeIntAsStringKey
- NegativeIntAsNumberKey
- FloatAsStringKey
- FloatAsNumberKey
- SecretWithDollarSignEscapedAndAndNoQuotesKey
- SecretWithDollarSignEscapedAndDoubleQuoteKey
- SecretWithDollarSignNotEscapedAndSingleQuoteKey
- SecretWithDollarSignNotEscapedAndDoubleQuotesKey
- SecretWithDollarSignNotEscapedAndNoQuotesKey
- SecretWithWeirdCharactersKey
environments:
- dev
- staging
- prod
environment_secrets:
- ServiceKey
- Server
9 changes: 9 additions & 0 deletions spec/fixtures/dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: sample
description: A minimal sample
version: 1.0.0

environment:
sdk: ^3.4.0

dev_dependencies:
test: ^1.25.7

0 comments on commit e34aea3

Please sign in to comment.