stack_wallet/.github/workflows/test.yaml
2022-10-18 13:43:40 -06:00

108 lines
6 KiB
YAML

#should deny
name: Test
on: [pull_request]
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Prepare repository
uses: actions/checkout@v3
with:
flutter-version: '3.3.4'
channel: 'stable'
- name: Install Flutter
uses: subosito/flutter-action@v2
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Build Lelantus
run: |
cd crypto_plugins/flutter_liblelantus/scripts/linux/
./build_all.sh
- name: Get dependencies
run: flutter pub get
- name: Create temp files
id: secret-file1
run: |
$secretFileExchange = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "lib/external_api_keys.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:CHANGE_NOW);
Set-Content $secretFileExchange -Value $encodedBytes -AsByteStream;
$secretFileExchangeHash = Get-FileHash $secretFileExchange;
Write-Output "::set-output name=SECRET_FILE_EXCHANGE::$secretFileExchange";
Write-Output "::set-output name=SECRET_FILE_EXCHANGE_HASH::$($secretFileExchangeHash.Hash)";
Write-Output "Secret file $secretFileExchange has hash $($secretFileExchangeHash.Hash)";
$secretFileBitcoin = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/bitcoin/bitcoin_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:BITCOIN_TEST);
Set-Content $secretFileBitcoin -Value $encodedBytes -AsByteStream;
$secretFileBitcoinHash = Get-FileHash $secretFileBitcoin;
Write-Output "::set-output name=SECRET_FILE_BITCOIN::$secretFileBitcoin";
Write-Output "::set-output name=SECRET_FILE_BITCOIN_HASH::$($secretFileBitcoinHash.Hash)";
Write-Output "Secret file $secretFileBitcoin has hash $($secretFileBitcoinHash.Hash)";
$secretFileDogecoin = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/dogecoin/dogecoin_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:DOGECOIN_TEST);
Set-Content $secretFileDogecoin -Value $encodedBytes -AsByteStream;
$secretFileDogecoinHash = Get-FileHash $secretFileDogecoin;
Write-Output "::set-output name=SECRET_FILE_DOGECOIN::$secretFileDogecoin";
Write-Output "::set-output name=SECRET_FILE_DOGECOIN_HASH::$($secretFileDogecoinHash.Hash)";
Write-Output "Secret file $secretFileDogecoin has hash $($secretFileDogecoinHash.Hash)";
$secretFileFiro = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/firo/firo_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:FIRO_TEST);
Set-Content $secretFileFiro -Value $encodedBytes -AsByteStream;
$secretFileFiroHash = Get-FileHash $secretFileFiro;
Write-Output "::set-output name=SECRET_FILE_FIRO::$secretFileFiro";
Write-Output "::set-output name=SECRET_FILE_FIRO_HASH::$($secretFileFiroHash.Hash)";
Write-Output "Secret file $secretFileFiro has hash $($secretFileFiroHash.Hash)";
$secretFileBitcoinCash = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/bitcoincash/bitcoincash_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:BITCOINCASH_TEST);
Set-Content $secretFileBitcoinCash -Value $encodedBytes -AsByteStream;
$secretFileBitcoinCashHash = Get-FileHash $secretFileBitcoinCash;
Write-Output "::set-output name=SECRET_FILE_BITCOINCASH::$secretFileBitcoinCash";
Write-Output "::set-output name=SECRET_FILE_BITCOINCASH_HASH::$($secretFileBitcoinCashHash.Hash)";
Write-Output "Secret file $secretFileBitcoinCash has hash $($secretFileBitcoinCashHash.Hash)";
$secretFileNamecoin = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/namecoin/namecoin_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:NAMECOIN_TEST);
Set-Content $secretFileNamecoin -Value $encodedBytes -AsByteStream;
$secretFileNamecoinHash = Get-FileHash $secretFileNamecoin;
Write-Output "::set-output name=SECRET_FILE_NAMECOIN::$secretFileNamecoin";
Write-Output "::set-output name=SECRET_FILE_NAMECOIN_HASH::$($secretFileNamecoinHash.Hash)";
Write-Output "Secret file $secretFileNamecoin has hash $($secretFileNamecoinHash.Hash)";
shell: pwsh
env:
CHANGE_NOW: ${{ secrets.CHANGE_NOW }}
BITCOIN_TEST: ${{ secrets.BITCOIN_TEST }}
DOGECOIN_TEST: ${{ secrets.DOGECOIN_TEST }}
FIRO_TEST: ${{ secrets.FIRO_TEST }}
BITCOINCASH_TEST: ${{ secrets.BITCOINCASH_TEST }}
NAMECOIN_TEST: ${{ secrets.NAMECOIN_TEST }}
# - name: Analyze
# run: flutter analyze
- name: Test
run: 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
- name: Delete temp files
run: |
Remove-Item -Path $env:CHANGE_NOW;
Remove-Item -Path $env:BITCOIN_TEST;
Remove-Item -Path $env:DOGECOIN_TEST;
Remove-Item -Path $env:FIRO_TEST;
Remove-Item -Path $env:BITCOINCASH_TEST;
Remove-Item -Path $env:NAMECOIN_TEST;
shell: pwsh
if: always()
env:
CHANGE_NOW: ${{ steps.secret-file1.outputs.SECRET_FILE_EXCHANGE }}
BITCOIN_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_BITCOIN }}
DOGECOIN_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_DOGECOIN }}
FIRO_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_FIRO }}
BITCOINCASH_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_BITCOINCASH }}
NAMECOIN_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_NAMECOIN }}