Julian/various fixes contd #2675
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: [pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: read | |
| container: | |
| image: ghcr.io/${{ github.repository_owner }}/stackwallet-ci:test | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| steps: | |
| - name: Prepare repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| # -d enables the pinned Epic/MWC native-assets prebuilts for flutter test. | |
| - name: Configure app (prebuilt native assets) | |
| run: | | |
| cd scripts | |
| echo "yes" | ./build_app.sh -v "0.0.1" -b "1" -p "linux" -a "stack_wallet" -d -s | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Decode secrets | |
| env: | |
| CHANGE_NOW: ${{ secrets.CHANGE_NOW }} | |
| run: | | |
| if [ -n "$CHANGE_NOW" ]; then | |
| echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart | |
| else | |
| cat > lib/external_api_keys.dart << 'EOF' | |
| const String kChangeNowApiKey = ""; | |
| const String kSimpleSwapApiKey = ""; | |
| const String kNanswapApiKey = ""; | |
| const String kNanoSwapRpcApiKey = ""; | |
| const String kWizSwapApiKey = ""; | |
| const kShopInBitAccessKey = ""; | |
| const kShopInBitPartnerSecret = ""; | |
| const kCakePayApiToken = ""; | |
| const kExolixApiKey = ""; | |
| EOF | |
| fi | |
| - name: Ensure app config for tests | |
| run: bash scripts/ensure_test_app_config.sh | |
| - name: Create test stubs | |
| run: bash prebuild.sh | |
| working-directory: scripts | |
| - name: Check formatting of changed files | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| BASE=$(git merge-base ${{ github.event.pull_request.base.sha }} HEAD) | |
| else | |
| BASE=${{ github.event.before }} | |
| fi | |
| FILES=$(git diff --name-only --diff-filter=ACM "$BASE"..HEAD -- '*.dart') | |
| if [ -z "$FILES" ]; then | |
| echo "No Dart files changed." | |
| exit 0 | |
| fi | |
| echo "Checking formatting of $(echo "$FILES" | wc -l) file(s):" | |
| echo "$FILES" | |
| dart format --output=none --set-exit-if-changed $FILES | |
| # - name: Analyze | |
| # run: flutter analyze | |
| - name: Test | |
| run: | | |
| bash scripts/ensure_test_app_config.sh | |
| test -s lib/app_config.g.dart | |
| grep -Fq "part of 'app_config.dart';" lib/app_config.g.dart | |
| flutter test --coverage | |
| - name: Upload to code coverage | |
| uses: codecov/codecov-action@v1.2.2 | |
| if: success() || failure() | |
| with: | |
| token: ${{secrets.CODECOV_TOKEN}} | |
| file: coverage/lcov.info |