diff --git a/.github/actions/extend-space-macos/action.yaml b/.github/actions/extend-space-macos/action.yaml new file mode 100644 index 00000000..e218f69c --- /dev/null +++ b/.github/actions/extend-space-macos/action.yaml @@ -0,0 +1,166 @@ +# Extends disk space on github hosted runners + +name: "Extend space macOS" +description: "Teases out as much free space as possible" + +runs: + using: "composite" + steps: + - name: Extend space macos + shell: "bash" + run: | + set -e + set -u + set -o pipefail + + # Uninstall Gems. + for gem in $(gem list --no-versions | grep -v \ + -e 'bigdecimal' \ + -e 'CFPropertyList' \ + -e 'cmath' \ + -e 'csv' \ + -e 'date' \ + -e 'dbm' \ + -e 'did_you_mean' \ + -e 'e2mmap' \ + -e 'etc' \ + -e 'fcntl' \ + -e 'fiddle' \ + -e 'fileutils' \ + -e 'forwardable' \ + -e 'io-console' \ + -e 'ipaddr' \ + -e 'irb' \ + -e 'json' \ + -e 'libxml-ruby' \ + -e 'logger' \ + -e 'matrix' \ + -e 'minitest' \ + -e 'mutex_m' \ + -e 'net-telnet' \ + -e 'nokogiri' \ + -e 'openssl' \ + -e 'ostruct' \ + -e 'power_assert' \ + -e 'prime' \ + -e 'psych' \ + -e 'rake' \ + -e 'rexml' \ + -e 'rdoc' \ + -e 'rbs' \ + -e 'rss' \ + -e 'scanf' \ + -e 'shell' \ + -e 'sqlite3' \ + -e 'stringio' \ + -e 'strscan' \ + -e 'sync' \ + -e 'test-unit' \ + -e 'thwait' \ + -e 'tracer' \ + -e 'typeprof' \ + -e 'webrick' \ + -e 'xmlrpc' \ + -e 'zlib' \ + ); do + sudo gem uninstall --force --all --ignore-dependencies --executables "$gem" + done + + # Uninstall Homebrew. + brew update + sudo rm -rf /usr/local/miniconda & + rm -rf /usr/local/lib/node_modules & + rm -f /usr/local/bin/terminal-notifier + rm -f /usr/local/bin/change_hostname.sh + rm -f /usr/local/bin/azcopy + + if which brew &>/dev/null; then + eval "$(brew list --formula | xargs -I% echo 'brew uninstall --formula --force --ignore-dependencies "%" &')" + eval "$(brew list --cask | xargs -I% echo '{ brew uninstall --cask --force "%"; brew uninstall --cask --zap --force "%"; } &')" + brew uninstall --cask --zap --force dotnet & + brew uninstall --cask --zap --force adoptopenjdk/openjdk/adoptopenjdk8 & + brew uninstall --cask --zap --force mono-mdk & + brew uninstall --cask --zap --force xamarin-android & + brew uninstall --cask --zap --force xamarin-ios & + brew uninstall --cask --zap --force xamarin-mac & + wait + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force + fi + + # # Uninstall Xcode and Command Line Tools + # mkdir -p /tmp/trash + # for trash in /Applications/Xcode*.app /Library/Developer/CommandLineTools; do + # sudo mv "$trash" /tmp/trash/ + # done + # sudo pkgutil --forget com.apple.pkg.CLTools_Executables + # sudo xcode-select --reset + + # Clean environment. + for trash in ~/.DS_Store \ + ~/.Trash/* \ + ~/.aliyun \ + ~/.android \ + ~/.azcopy \ + ~/.azure \ + ~/.bash_history \ + ~/.bash_profile \ + ~/.bash_sessions \ + ~/.bashrc \ + ~/.cabal \ + ~/.cache \ + ~/.cargo \ + ~/.cocoapods \ + ~/.composer \ + ~/.conda \ + ~/.config \ + ~/.dotnet \ + ~/.fastlane \ + ~/.gem \ + ~/.ghcup \ + ~/.gitconfig \ + ~/.gradle \ + ~/.local \ + ~/.m2 \ + ~/.mono \ + ~/.npm \ + ~/.npmrc \ + ~/.nvm \ + ~/.oracle_jre_usage \ + ~/.packer.d \ + ~/.rustup \ + ~/.sh_history \ + ~/.ssh \ + ~/.subversion \ + ~/.sqlite_history \ + ~/.vcpkg \ + ~/.viminfo \ + ~/.wget-hsts \ + ~/.yarn \ + ~/Library/Caches/Homebrew \ + ~/Microsoft \ + ~/hostedtoolcache \ + ~/*.txt; do + if [[ -e "$trash" ]]; then + mv "$trash" /tmp/trash/ + fi + done + + # Delete broken symlinks. + for exe in /usr/local/bin/*; do + if [[ -L "$exe" ]] && ! [[ -e "$exe" ]]; then + rm "$exe" + fi + done + + mkdir -p /tmp/trash + for pkg in /var/db/receipts/*.plist; do + pkg_id="$(basename "${pkg}" .plist)" + volume="$(pkgutil --pkg-info "${pkg_id}" | sed -n -e 's/^volume: //p')" + location="$(pkgutil --pkg-info "${pkg_id}" | sed -n -e 's/^location: //p')" + pkgutil --only-files --files "${pkg_id}" | xargs -I% sudo mv -f "${volume}${location}/%" /tmp/trash/ || true + pkgutil --only-dirs --files "${pkg_id}" | xargs -I% sudo rmdir -p "${volume}${location}/%" || true + pkgutil --forget "${pkg_id}" + done + + + diff --git a/.github/workflows/release-happ.yaml b/.github/workflows/release-happ.yaml new file mode 100644 index 00000000..ac396a84 --- /dev/null +++ b/.github/workflows/release-happ.yaml @@ -0,0 +1,59 @@ +name: "release-happ" +on: + push: + tags: + - 'happ-v[0-9]+.[0-9]+.[0-9]+' + branches: + - develop-0.3 + +jobs: + publish-happ: + permissions: + contents: write + runs-on: ubuntu-22.04 + outputs: + releaseId: ${{ steps.create-release.outputs.id }} + appVersion: ${{ steps.version.outputs.APP_VERSION }} + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Checks out a copy of your repository on the ubuntu-latest machine + - uses: actions/checkout@v3 + + - name: Install nix + uses: cachix/install-nix-action@v27 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-24.05 + + - uses: cachix/cachix-action@v15 + with: + name: holochain-ci + + - uses: cachix/cachix-action@v15 + with: + name: holochain-open-dev + + - uses: cachix/cachix-action@v15 + with: + name: darksoil-studio + + - name: Install and test + run: | + nix-store --gc + nix develop --no-update-lock-file --accept-flake-config --command bash -c "npm install && npm run build:happ" + + - name: Retrieve version + run: | + echo "APP_VERSION=$(cat src-tauri/tauri.conf.json | grep -oP '(?<="version": ")[^"]*')" >> $GITHUB_OUTPUT + id: version + + - id: create-release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "workdir/relay.happ" + body: "See assets below to download and install this version." + name: Relay hApp v${{ steps.version.outputs.APP_VERSION }} + tag: happ-v${{ steps.version.outputs.APP_VERSION }} + prerelease: true + draft: false diff --git a/.github/workflows/release-tauri-app.yaml b/.github/workflows/release-tauri-app.yaml index 9af5d4e8..6e12e0b4 100644 --- a/.github/workflows/release-tauri-app.yaml +++ b/.github/workflows/release-tauri-app.yaml @@ -3,16 +3,73 @@ on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-[a-z-]+.[0-9]+' + branches: + - develop-0.3 jobs: - publish-happ: - permissions: - contents: write - runs-on: ubuntu-22.04 + release-tauri-app-linux: + permissions: write-all outputs: - releaseId: ${{ steps.create-release.outputs.id }} - appVersion: ${{ steps.version.outputs.APP_VERSION }} + releaseId: ${{ steps.build-app.outputs.releaseId }} + + runs-on: ubuntu-22.04 + steps: + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Checks out a copy of your repository on the ubuntu-latest machine + - uses: actions/checkout@v3 + + - name: setup node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: install Rust stable + uses: actions-rs/toolchain@v1 + with: + override: true + toolchain: 1.80.1 + + - name: install Go stable + uses: actions/setup-go@v4 + with: + go-version: "stable" + + - name: install dependencies (ubuntu only) + run: | + sudo apt update + sudo apt install libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + + - name: Install and prepare + run: | + npm install + npm run setup:happ-release + + - id: build-app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: Relay-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'Relay v__VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: false + + release-tauri-app-android: + permissions: write-all + needs: release-tauri-app-linux + environment: Relay Release + + runs-on: 'ubuntu-22.04' steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks out a copy of your repository on the ubuntu-latest machine @@ -22,118 +79,132 @@ jobs: uses: ./.github/actions/extend-space - name: Install nix - uses: cachix/install-nix-action@v18 + uses: cachix/install-nix-action@v27 with: - install_url: https://releases.nixos.org/nix/nix-2.13.3/install - extra_nix_config: | - experimental-features = flakes nix-command + github_access_token: ${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-24.05 - - uses: cachix/cachix-action@v12 + - uses: cachix/cachix-action@v15 with: name: holochain-ci - - uses: cachix/cachix-action@v12 + - uses: cachix/cachix-action@v15 + with: + name: holochain-open-dev + + - uses: cachix/cachix-action@v15 with: name: darksoil-studio - - name: Install and test + - name: Install and prepare run: | - nix-store --gc - nix develop --command bash -c "npm i && npm run build:happ" + nix develop --no-update-lock-file --command npm install && npm run setup:happ-release - - name: Retrieve version + - name: setup Android signing run: | - echo "APP_VERSION=$(cat src-tauri/tauri.conf.json | grep -oP '(?<="version": ")[^"]*')" >> $GITHUB_OUTPUT - id: version - - - id: create-release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: "workdir/relay.happ" - body: "See assets below to download and install this version." - name: Volla Messages v${{ steps.version.outputs.APP_VERSION }} - tag: v${{ steps.version.outputs.APP_VERSION }} - prerelease: true - draft: true - - release-tauri-app: - needs: publish-happ - strategy: - fail-fast: false - matrix: - platform: [windows-2019, macos-11, ubuntu-22.04] - env: - MACOSX_DEPLOYMENT_TARGET: 10.13 + cd src-tauri/gen/android + echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties + echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties + base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks + echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties - runs-on: ${{ matrix.platform }} + - name: Build android APKs + run: | + nix develop .#androidDev --no-update-lock-file --command bash -c "npm run tauri android build -- --apk --split-per-abi --target aarch64 --target i686 --target x86_64" + + - uses: AButler/upload-release-assets@v3.0 + with: + files: src-tauri/gen/android/app/build/outputs/apk/*/release/app-* + repo-token: ${{ secrets.GITHUB_TOKEN }} + release-id: ${{ needs.release-tauri-app-linux.outputs.releaseId }} + + release-tauri-app-windows: + permissions: write-all + + runs-on: windows-latest steps: - - name: Support longpaths - if: matrix.platform != 'ubuntu-22.04' - run: git config --system core.longpaths true # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks out a copy of your repository on the ubuntu-latest machine - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: setup node uses: actions/setup-node@v1 with: node-version: 20 + - name: install Rust stable uses: actions-rs/toolchain@v1 with: override: true - toolchain: stable + toolchain: 1.80.1 - name: install Go stable uses: actions/setup-go@v4 with: go-version: "stable" - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-22.04' - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.0-dev \ - build-essential \ - curl \ - wget \ - file \ - libssl-dev \ - libgtk-3-dev \ - libayatana-appindicator3-dev \ - librsvg2-dev \ - javascriptcoregtk-4.1 \ - libsoup-3.0 \ - webkit2gtk-4.1 - - name: Install and prepare run: | npm install + npm run setup:happ-release - - name: Print version - run: | - echo "The Version was: ${{ needs.publish-happ.outputs.appVersion }}" - id: print-version - - - name: Download release of the .happ - id: release_data - uses: KevinRohn/github-full-release-data@v2 + - name: build the app + uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - repository: "holochain-apps/relay" - token: ${{ secrets.GITHUB_TOKEN }} - version: v${{ needs.publish-happ.outputs.appVersion }} - asset-file: '*.happ' - asset-output: 'workdir/' + tagName: Relay-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'Relay v__VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: false + + release-tauri-app-macos: + permissions: write-all + + strategy: + fail-fast: false + matrix: + include: + - platform: 'macos-latest' # for Arm based macs (M1 and above). + - platform: 'macos-13' # for Intel based macs. + # - platform: 'ubuntu-22.04' + + runs-on: ${{ matrix.platform }} + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Checks out a copy of your repository on the ubuntu-latest machine + - uses: actions/checkout@v3 + + - name: setup node + uses: actions/setup-node@v1 + with: + node-version: 20 + + - name: install Rust stable + uses: actions-rs/toolchain@v1 + with: + override: true + toolchain: 1.80.1 + + - name: install Go stable + uses: actions/setup-go@v4 + with: + go-version: stable + + - name: Install and prepare + run: | + npm install + npm run setup:happ-release - name: build the app uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - releaseId: ${{ needs.publish-happ.outputs.releaseId }} + tagName: Relay-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'Relay v__VERSION__' + releaseBody: 'See the assets to download this version and install.' releaseDraft: true - prerelease: true + prerelease: false diff --git a/README.md b/README.md index ddbb51be..204f62f1 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,15 @@ Volla Messages is a Holochain application deployed using [p2pShipyard](https://d `npm run tauri android build` `adb -s device install /path/to/relay.apk` +### Testing with a .happ release + +To test with the released version of the `.happ`, run: + +`nix develop` +`npm run setup:happ-release` +`AGENTS=2 npm run network` + +The `.happ` release that is downloaded with this script can be changed in the `setup:happ-release` script in the [package.json](./package.json). ## License diff --git a/package.json b/package.json index 66d995f0..b4cb9868 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,16 @@ "name": "volla_messages", "version": "0.7.0-beta", "private": true, - "workspaces": [ - "ui" - ], + "workspaces": ["ui"], "scripts": { - "start": "AGENTS=2 npm run network", + "start": "npm run build:happ && AGENTS=2 npm run network", "spin": "AGENTS=2 npm run spin-network", "dev": "VITE_ADMIN_PORT=$(port) VITE_APP_PORT=$(port) SIGNAL_PORT=$(port) BOOTSTRAP_PORT=$(port) UI_PORT=8888 npm run x", "x": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run start:happ\" \"hc run-local-services -b $BOOTSTRAP_PORT -s $SIGNAL_PORT\"", "tool-dev": " UI_PORT=8888 npm run tool-devy", "tool-devy": "concurrently \"npm start -w ui\" \"sleep 1 && we-dev-cli --agent-idx 1 --dev-config we_dev/config.ts\" \"sleep 10 && we-dev-cli --agent-idx 2 --dev-config we_dev/config.ts\"", "tool-devx": "BPORT=46263 SPORT=46262; concurrently \"hc run-local-services -b $BPORT -s $SPORT\" \"npm start -w ui\" \"./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 1 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\" \"sleep 10 && ./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 2 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\"", - "network": "npm run build:happ && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm run -w ui start\" \"npm run launch\"", + "network": "BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm run -w ui start\" \"npm run launch\"", "spin-network": "hc s clean && npm run build:happ && UI_PORT=1420 concurrently \"npm start -w ui\" \"npm run spin:happ\" \"holochain-playground\"", "test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests", "launch:happ": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/relay.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"", @@ -26,7 +24,8 @@ "network:android": "npm run build:happ && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm run -w ui start\" \"npm run tauri android dev\" \"npm run tauri dev\"", "start:android": "npm run build:happ && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm run -w ui start\" \"npm run tauri android dev\"", "launch": "concurrently-repeat \"npm run tauri dev\" $AGENTS", - "tauri": "tauri" + "tauri": "tauri", + "setup:happ-release": "curl -L https://github.com/holochain-apps/relay/releases/download/v0.7.0-beta/relay-0.7.0-beta.happ -o workdir/relay.happ" }, "devDependencies": { "@holochain-playground/cli": "^0.2.0",