Setup Testing #117
This file contains 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 Suite | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
GOPRIVATE: github.com/getlantern | |
jobs: | |
test-suite: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest-16-cores, windows-latest ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Pull LFS objects | |
run: git lfs pull | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Granting private modules access | |
run: git config --global url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" | |
- name: GCloud Auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: 'Set up Cloud SDK' | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install latest protoc-gen-go | |
run: go install github.com/golang/protobuf/protoc-gen-go@latest | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: 'gradle' | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: Activate dart plugins | |
run: | | |
dart pub global activate protoc_plugin | |
dart pub global activate patrol_cli | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Generate app.env | |
env: | |
ANDROID_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID }} | |
IOS_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID_IOS }} | |
TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID }} | |
TAPSELL_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_INTERSTITIAL_ZONE_ID }} | |
run: | | |
touch app.env | |
echo "Android_interstitialAd=$ANDROID_INTERSTITIAL_AD_ID" > app.env | |
echo "IOS_interstitialAd=$IOS_INTERSTITIAL_AD_ID" >> app.env | |
echo "VideoInterstitialZoneId=$TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID" >> app.env | |
echo "InterstitialZoneId=$TAPSELL_INTERSTITIAL_ZONE_ID" >> app.env | |
- name: Setup Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
if: runner.os == 'macOS' | |
with: | |
xcode-version: latest-stable | |
- name: Install Linux dependencies | |
if: runner.os == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y network-manager dbus-x11 | |
sudo apt-get install -y libwebkit2gtk-4.1-dev | |
sudo apt-get install -y libunwind-dev libstdc++-12-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-d cmake | |
sudo apt-get install -y libgtk-3-0 libblkid1 liblzma5 | |
sudo apt-get install -y libpcap-dev libgtk-3-dev libayatana-appindicator3-dev ruby ruby-dev && sudo gem install bundler -v 2.2.26 | |
- name: Install the ninja build tool | |
if: runner.os == 'linux' | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Install WebView2 Runtime | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebView2Setup.exe" | |
Start-Process -FilePath ".\MicrosoftEdgeWebView2Setup.exe" -ArgumentList "/silent", "/install" -Wait | |
- name: Set up MinGW | |
if: matrix.os == 'windows-latest' | |
run: choco install mingw -y | |
- name: Build for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "Building for Windows..." | |
make windows | |
make ffigen | |
- name: Build linux Libraries | |
shell: bash | |
if: runner.os == 'linux' | |
run: | | |
make android ANDROID_ARCH=all | |
make linux | |
make ffigen | |
- name: Build for IOS | |
if: runner.os == 'macOS' | |
run: | | |
make ios | |
make ffigen | |
- name: Running widget tests | |
run: make widget-tests | |
# Run firebase test only on one OS runner | |
# Does not make sense to run on all OS runners | |
- name: Running workflow test for android on Firebase test labs | |
if: runner.os == 'linux' | |
run: make ci-android-test | |
- name: Starting Simulator | |
id: simulator | |
if: runner.os == 'macOS' | |
uses: futureware-tech/simulator-action@v4 | |
with: | |
model: 'iPhone 15 Pro' | |
- name: Running workflow test for iOS | |
run: patrol test -d ${{ steps.simulator.outputs.udid }} | |
if: runner.os == 'macOS' | |
timeout-minutes: 70 | |
- name: Upload xc result | |
if: runner.os == 'macOS' && always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xc-result | |
path: ${{ github.workspace }}/build/ios | |
retention-days: 2 | |
- name: Running workflow test for linux | |
uses: coactions/setup-xvfb@v1 | |
if: runner.os == 'linux' | |
timeout-minutes: 60 | |
with: | |
run: | | |
sudo systemctl start dbus | |
sudo systemctl start NetworkManager | |
make linuxDesktopTest | |
- name: Running workflow test for windows | |
run: make windowsDesktopTest | |
if: runner.os == 'windows' | |
timeout-minutes: 60 |