diff --git a/.github/workflows/analyze-and-unit-test.yaml b/.github/workflows/analyze-and-unit-test.yaml new file mode 100644 index 0000000..abaa26a --- /dev/null +++ b/.github/workflows/analyze-and-unit-test.yaml @@ -0,0 +1,37 @@ +name: Tests +on: + workflow_dispatch: + pull_request: + push: + +env: + FLUTTER_VERSION: "stable" +jobs: + test: + name: Analyze and test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - id: puro_version + run: | + content=`cat ./puro.json` + # the following lines are only required for multi line json + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + # end of optional handling for multi line json + echo "::set-output name=packageJson::$content" + - run: | + export FLUTTER_VERSION="${{fromJson(steps.puro_version.outputs.packageJson).env}}" + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ env.FLUTTER_VERSION }} + channel: "stable" + - name: Install dependencies + run: flutter pub get + - name: Analyze + run: flutter analyze + - name: Test + run: flutter test