diff --git a/.github/actions/extend-space/action.yaml b/.github/actions/extend-space/action.yaml index 67ccc0cb..e218f69c 100644 --- a/.github/actions/extend-space/action.yaml +++ b/.github/actions/extend-space/action.yaml @@ -1,61 +1,166 @@ # Extends disk space on github hosted runners - -name: "Extend space" +name: "Extend space macOS" description: "Teases out as much free space as possible" runs: using: "composite" steps: - - name: Create mountpoint for extended space - shell: "bash" - run: sudo mkdir /mnt/extended - - - name: Maximize build space - uses: easimon/maximize-build-space@v6 - # uses: AdityaGarg8/remove-unwanted-software@v1 - with: - remove-dotnet: true - remove-android: true - remove-haskell: true - build-mount-path: /mnt/extended - root-reserve-mb: 512 - swap-size-mb: 1024 - - # after we've got the extended space mounted, we can use overlayfs and bind - # mounts as appropriate to make this space available to all paths that are - # expected to be written to. - # - # for new directories (such as /nix), a bind mount is enough for existing - # directories (such as $HOME and /tmp), we use an overlay to preserve access - # to the existing files, while redirecting changes to the extended space. - - name: Use extended space for /nix, /tmp, /var/tmp, and $HOME + - name: Extend space macos shell: "bash" run: | - export EXTENDED_PATH=/mnt/extended - sudo mkdir $EXTENDED_PATH/{tmp,nix,home} - sudo mkdir $EXTENDED_PATH/tmp/{upper,work} - sudo mv /tmp{,_lower} - sudo mkdir /tmp - sudo mount -t overlay overlay \ - -o lowerdir=/tmp_lower,upperdir=$EXTENDED_PATH/tmp/upper,workdir=$EXTENDED_PATH/tmp/work \ - /tmp - sudo chown $(id -u):$(id -g) /tmp - sudo mkdir -p $EXTENDED_PATH/var/tmp/{upper,work} - sudo mv /var/tmp{,_lower} - sudo mkdir -p /var/tmp - sudo mount -t overlay overlay \ - -o lowerdir=/var/tmp_lower,upperdir=$EXTENDED_PATH/var/tmp/upper,workdir=$EXTENDED_PATH/var/tmp/work \ - /var/tmp - sudo chown $(id -u):$(id -g) /var/tmp - sudo mkdir /nix - sudo mount -o bind $EXTENDED_PATH/nix /nix - sudo mkdir $EXTENDED_PATH/home/{upper,work} - sudo mv ${HOME} ${HOME}_lower - sudo mkdir ${HOME} - sudo chown $(id -u):$(id -g) $HOME - sudo mount -t overlay overlay \ - -o lowerdir=${HOME}_lower,upperdir=$EXTENDED_PATH/home/upper,workdir=$EXTENDED_PATH/home/work \ - $HOME - sudo chown $(id -u):$(id -g) $HOME - df -h + 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-tauri-app.yaml b/.github/workflows/release-tauri-app.yaml index 645e1ff1..4c475fc9 100644 --- a/.github/workflows/release-tauri-app.yaml +++ b/.github/workflows/release-tauri-app.yaml @@ -65,13 +65,8 @@ jobs: matrix: include: - platform: 'macos-latest' # for Arm based macs (M1 and above). - args: '--target aarch64-apple-darwin' - - platform: 'macos-latest' # for Intel based macs. - args: '--target x86_64-apple-darwin' - - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. - args: '' - - platform: 'windows-latest' - args: '' + - platform: 'macos-13' # for Intel based macs. + # - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. env: MACOSX_DEPLOYMENT_TARGET: 10.13 @@ -84,50 +79,81 @@ jobs: # 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 + + - name: Extend space + if: matrix.platform == 'ubuntu-22.04' + uses: ./.github/actions/extend-space + + - name: Extend space macos + if: matrix.platform != 'ubuntu-22.04' + uses: ./.github/actions/extend-space-macos - name: Install nix - if: matrix.platform != 'windows-latest' 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 - if: matrix.platform != 'windows-latest' with: name: holochain-ci - uses: cachix/cachix-action@v15 - if: matrix.platform != 'windows-latest' with: name: holochain-open-dev - uses: cachix/cachix-action@v15 - if: matrix.platform != 'windows-latest' with: name: darksoil-studio - - - 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 - - name: install x86_64 target - if: matrix.args == '--target x86_64-apple-darwin' - run: rustup target add x86_64-apple-darwin + - name: Install and prepare + run: | + nix develop --no-update-lock-file --command npm install + + - name: Download release of the .happ + uses: robinraju/release-downloader@v1.10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + releaseId: ${{ needs.publish-happ.outputs.releaseId }} + fileName: 'relay.happ' + out-file-path: 'workdir/' - - name: install Go stable - uses: actions/setup-go@v4 + - name: build the app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - go-version: "stable" + tauriScript: nix develop --no-update-lock-file --command npm tauri + releaseId: ${{ needs.publish-happ.outputs.releaseId }} + releaseDraft: true + prerelease: true - - name: install dependencies (ubuntu only) + release-tauri-app-linux: + needs: publish-happ + permissions: write-all + strategy: + fail-fast: false + matrix: + include: + - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. + + runs-on: ${{ matrix.platform }} + 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 + + - name: Extend space if: matrix.platform == 'ubuntu-22.04' + uses: ./.github/actions/extend-space + + - name: install dependencies (ubuntu only) run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.0-dev \ @@ -143,9 +169,82 @@ jobs: libsoup-3.0 \ webkit2gtk-4.1 + - 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.77.2 + + - name: install Go stable + uses: actions/setup-go@v4 + with: + go-version: "stable" + + - name: Install and prepare + run: | + npm install + + - name: Download release of the .happ + uses: robinraju/release-downloader@v1.10 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + releaseId: ${{ needs.publish-happ.outputs.releaseId }} + fileName: 'relay.happ' + out-file-path: 'workdir/' + + - name: build the app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.publish-happ.outputs.releaseId }} + releaseDraft: true + prerelease: true + + release-tauri-app-windows: + permissions: write-all + needs: publish-happ + + runs-on: windows-latest + 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.77.2 + + - name: install Go stable + uses: actions/setup-go@v4 + with: + go-version: "stable" + - name: Install and prepare run: | npm install + + - name: build the app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.publish-happ.outputs.releaseId }} - name: Print version run: | @@ -161,11 +260,6 @@ jobs: releaseId: ${{ needs.publish-happ.outputs.releaseId }} fileName: 'relay.happ' out-file-path: 'workdir/' - - - name: build the app in nix to work around sysroot issue building tx5 - if: matrix.platform == 'macos-latest' - run: | - nix develop --command bash -c "npm run build -w ui && cargo build --bins --features tauri/custom-protocol,tauri/native-tls --release" - name: build the app uses: tauri-apps/tauri-action@v0 @@ -175,4 +269,3 @@ jobs: releaseId: ${{ needs.publish-happ.outputs.releaseId }} releaseDraft: true prerelease: true - args: ${{ matrix.args }}