Skip to content

Commit

Permalink
merge latest and clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Oct 28, 2024
2 parents 93d38a0 + 6252424 commit 8d050d5
Show file tree
Hide file tree
Showing 121 changed files with 4,652 additions and 2,337 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ jobs:
java-version: 17
cache: 'gradle'

- name: Clean up disk space
run: |
df -h # Check disk space
sudo apt-get clean
sudo apt-get autoremove
- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
Expand Down Expand Up @@ -99,10 +93,20 @@ jobs:
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: Clean packages
run: |
sudo apt-get clean
sudo apt-get autoremove -y
sudo apt-get remove --purge $(dpkg --list | grep '^rc' | awk '{print $2}')
- name: Build Android installers
env:
Expand All @@ -111,6 +115,22 @@ jobs:
VERSION: "${{ env.version }}"
run: make package-android

- name: Clean Go module and build cache
run: |
sudo rm -rf /tmp/*
sudo rm -rf /var/cache/*
sudo apt-get clean
sudo apt-get autoremove -y
sudo apt-get remove --purge $(dpkg --list | grep '^rc' | awk '{print $2}')
go clean -modcache
go clean -cache -testcache
df -h
- name: Delete Gradle cache
run: |
sudo rm -rf $HOME/.gradle/caches
echo "Gradle cache deleted successfully"
- uses: actions/upload-artifact@v4
with:
name: android-apk-build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ jobs:
make package-darwin
env:
VERSION: "${{ env.version }}"
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERT }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERT_PASS }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_BNS_CERT }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_BNS_CERT_PASS }}

- name: Install s3cmd
run: pip install s3cmd
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y file build-essential pkg-config
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
Expand Down Expand Up @@ -86,15 +87,20 @@ jobs:

- run: touch app.env

- name: Extract app version from pubspec.yaml
run: |
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
- name: Build Flutter app
run: flutter build linux

- name: Build installer
run: |
cp liblantern.so "build/linux/${{inputs.dist-suffix}}/release/bundle"
make package-linux
mv dist/1.0.0+1/lantern-1.0.0+1-linux.deb lantern_${{inputs.version}}_x64.deb
mv dist/1.0.0+1/lantern-1.0.0+1-linux.rpm lantern_${{inputs.version}}_x64.rpm
mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.deb lantern_${{inputs.version}}_x64.deb
mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.rpm lantern_${{inputs.version}}_x64.rpm
- uses: actions/upload-artifact@v4
with:
Expand Down
214 changes: 45 additions & 169 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,108 +29,35 @@ env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
build-desktop:
build-windows:
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
runs-on: windows-latest
steps:
- 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 }}:[email protected]/".insteadOf "https://github.com/"
- name: Repo access
run: |
mkdir /tmp/cache
echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc
chmod 600 /tmp/cache/.netrc
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
organization: getlantern
project: android

- name: Install dependencies
run: |
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y mingw-w64 nsis
- name: Build liblantern.dll
if: ${{inputs.update-suffix == '386'}}
run: |
make windows
- name: Build liblantern.dll
if: ${{inputs.update-suffix == 'x64'}}
env:
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
VERSION: "${{ env.version }}"
run: |
make windows64
- uses: actions/upload-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-build
if-no-files-found: error
path: |
liblantern.dll
- uses: actions/upload-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-header
if-no-files-found: error
path: |
liblantern.h
- uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install s3cmd
run: pip install s3cmd

- name: Set s3cmd permissions
- name: Install WebView2 Runtime
shell: pwsh
run: |
echo "[default]" > "$HOME/.s3cfg"
echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebView2Setup.exe"
Start-Process -FilePath ".\MicrosoftEdgeWebView2Setup.exe" -ArgumentList "/silent", "/install" -Wait
- name: Push libgo to S3
run: s3cmd put --acl-public liblantern.dll "s3://lantern/liblantern-${{inputs.update-suffix}}.dll"
- name: Set up MinGW
run: choco install mingw -y

build-windows:
needs: build-desktop
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
# Install Flutter
- uses: subosito/flutter-action@v2
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"

Expand All @@ -141,26 +68,18 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Activate protoc-gen-dart plugin
run: |
dart pub global activate protoc_plugin
- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-build

- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-header

- run: make ffigen

- run: touch app.env
- name: Build Lantern Library
shell: bash
run: |
touch app.env
mkdir -p "build/windows/${{inputs.arch}}/runner/Release"
make windows64
- name: Build Flutter app
run: flutter build windows
- name: Activate plugins
run: |
dart pub global activate protoc_plugin
dart pub global activate flutter_distributor
- name: Sign liblantern.dll with Azure Code Signing
uses: getlantern/trusted-signing-action@main
Expand All @@ -177,74 +96,30 @@ jobs:
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256

- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-build-signed
path: |
liblantern.dll
- name: Create archive
- name: Move liblantern.dll to release directory
shell: bash
run: |
ls build/windows
cp liblantern.dll "build/windows/${{inputs.arch}}/runner/Release"
Compress-Archive "build/windows/${{inputs.arch}}/runner/Release" lantern.zip
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-build
path: lantern.zip

build-installer:
needs: build-windows
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release"
steps:
- name: Install dependencies
run: |
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y mingw-w64 nsis
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-build
- name: Make installer
- name: Extract app version from pubspec.yaml
id: extract_version
shell: bash
run: |
pwd
unzip lantern.zip
cp installer-resources-lantern/.packaged-lantern.yaml installer-resources-lantern/windows/.packaged-lantern.yaml
cp installer-resources-lantern/lantern.yaml installer-resources-lantern/windows/lantern.yaml
cp -r Release/* installer-resources-lantern/windows
makensis -V1 -DVERSION=${{ inputs.version }} -DAPP_NAME=lantern.exe -DOUT_FILE="lantern-installer${{inputs.installer-suffix}}.exe" installer-resources-lantern/windows/lantern.nsi
mv installer-resources-lantern/windows/lantern-installer${{inputs.installer-suffix}}.exe lantern-installer${{inputs.installer-suffix}}.exe
APP_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-installer-unsigned
path: lantern-installer${{inputs.installer-suffix}}.exe
- name: Build Flutter app
run: |
New-Item -Path "./dist/${{ env.APP_VERSION }}" -ItemType Directory -Force
flutter_distributor package --platform windows --targets exe --skip-clean
env:
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
VERSION: "${{ env.version }}"

sign-installer:
needs: build-installer
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: windows-latest
steps:
- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-unsigned
- name: Rename installer
shell: bash
run: |
mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows-setup.exe" lantern-installer${{inputs.installer-suffix}}.exe
- name: Sign EXE with Azure Code Signing
uses: getlantern/trusted-signing-action@main
Expand All @@ -255,27 +130,28 @@ jobs:
endpoint: https://wus2.codesigning.azure.net/
code-signing-account-name: code-signing
certificate-profile-name: Lantern
files-folder: ${{ github.workspace }}\
files-folder-filter: exe
files-folder: ${{ github.workspace }}/
files-folder-filter: exe,dll,msix
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256

- uses: actions/upload-artifact@v4
- name: Upload EXE artifact
uses: actions/upload-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-signed
path: |
lantern-installer${{inputs.installer-suffix}}.exe
upload-windows:
needs: sign-installer
needs: build-windows
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Download the artifact
Expand Down
Loading

0 comments on commit 8d050d5

Please sign in to comment.