diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56ea875d5cefec240d554984a8c0e1c1992a574c..ef05c1b199e84f52b07a4dd23a04c916f86f8be6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,10 +3,7 @@ name: release env: CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: '0' RUST_BACKTRACE: '1' - ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} - ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} on: push: tags: @@ -177,11 +174,15 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} timeout-minutes: 60 - bundle_linux_arm64: + bundle_linux_aarch64: needs: - run_tests_linux - check_scripts runs-on: namespace-profile-8x32-ubuntu-2004-arm-m4 + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -200,27 +201,28 @@ jobs: - name: ./script/bundle-linux run: ./script/bundle-linux shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-linux-aarch64.tar.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - path: target/release/zed-*.tar.gz + name: zed-linux-aarch64.tar.gz + path: target/release/zed-linux-aarch64.tar.gz if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-remote-server-linux-aarch64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - path: target/zed-remote-server-*.gz + name: zed-remote-server-linux-aarch64.gz + path: target/zed-remote-server-linux-aarch64.gz if-no-files-found: error - outputs: - zed: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz timeout-minutes: 60 bundle_linux_x86_64: needs: - run_tests_linux - check_scripts runs-on: namespace-profile-32x64-ubuntu-2004 + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -239,28 +241,28 @@ jobs: - name: ./script/bundle-linux run: ./script/bundle-linux shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-linux-x86_64.tar.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - path: target/release/zed-*.tar.gz + name: zed-linux-x86_64.tar.gz + path: target/release/zed-linux-x86_64.tar.gz if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-remote-server-linux-x86_64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - path: target/zed-remote-server-*.gz + name: zed-remote-server-linux-x86_64.gz + path: target/zed-remote-server-linux-x86_64.gz if-no-files-found: error - outputs: - zed: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz timeout-minutes: 60 - bundle_mac_arm64: + bundle_mac_aarch64: needs: - run_tests_mac - check_scripts runs-on: self-mini-macos env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} @@ -282,24 +284,21 @@ jobs: - name: steps::clear_target_dir_if_large run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac + - name: run_bundling::bundle_mac::bundle_mac run: ./script/bundle-mac aarch64-apple-darwin shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg' + - name: '@actions/upload-artifact Zed-aarch64.dmg' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg - path: target/aarch64-apple-darwin/release/Zed.dmg + name: Zed-aarch64.dmg + path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz' + - name: '@actions/upload-artifact zed-remote-server-macos-aarch64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz + name: zed-remote-server-macos-aarch64.gz path: target/zed-remote-server-macos-aarch64.gz if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz timeout-minutes: 60 bundle_mac_x86_64: needs: @@ -307,6 +306,9 @@ jobs: - check_scripts runs-on: self-mini-macos env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} @@ -328,31 +330,31 @@ jobs: - name: steps::clear_target_dir_if_large run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac + - name: run_bundling::bundle_mac::bundle_mac run: ./script/bundle-mac x86_64-apple-darwin shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg' + - name: '@actions/upload-artifact Zed-x86_64.dmg' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg - path: target/x86_64-apple-darwin/release/Zed.dmg + name: Zed-x86_64.dmg + path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz' + - name: '@actions/upload-artifact zed-remote-server-macos-x86_64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz + name: zed-remote-server-macos-x86_64.gz path: target/zed-remote-server-macos-x86_64.gz if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz timeout-minutes: 60 - bundle_windows_arm64: + bundle_windows_aarch64: needs: - run_tests_windows - check_scripts runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -371,18 +373,16 @@ jobs: uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: run_bundling::bundle_windows + - name: run_bundling::bundle_windows::bundle_windows run: script/bundle-windows.ps1 -Architecture aarch64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe' + - name: '@actions/upload-artifact Zed-aarch64.exe' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe - path: ${{ env.SETUP_PATH }} + name: Zed-aarch64.exe + path: target/Zed-aarch64.exe if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe timeout-minutes: 60 bundle_windows_x86_64: needs: @@ -390,6 +390,9 @@ jobs: - check_scripts runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -408,51 +411,49 @@ jobs: uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: run_bundling::bundle_windows + - name: run_bundling::bundle_windows::bundle_windows run: script/bundle-windows.ps1 -Architecture x86_64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe' + - name: '@actions/upload-artifact Zed-x86_64.exe' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe - path: ${{ env.SETUP_PATH }} + name: Zed-x86_64.exe + path: target/Zed-x86_64.exe if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe timeout-minutes: 60 upload_release_assets: needs: - create_draft_release - - bundle_linux_arm64 + - bundle_linux_aarch64 - bundle_linux_x86_64 - - bundle_mac_arm64 + - bundle_mac_aarch64 - bundle_mac_x86_64 - - bundle_windows_arm64 + - bundle_windows_aarch64 - bundle_windows_x86_64 runs-on: namespace-profile-4x8-ubuntu-2204 steps: - - name: release::upload_release_assets::download_workflow_artifacts + - name: release::download_workflow_artifacts uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: path: ./artifacts/ - name: ls -lR ./artifacts run: ls -lR ./artifacts shell: bash -euxo pipefail {0} - - name: release::upload_release_assets::prep_release_artifacts + - name: release::prep_release_artifacts run: |- mkdir -p release-artifacts/ - mv ./artifacts/${{ needs.bundle_mac_x86_64.outputs.zed }}/* release-artifacts/Zed-x86_64.dmg - mv ./artifacts/${{ needs.bundle_mac_arm64.outputs.zed }}/* release-artifacts/Zed-aarch64.dmg - mv ./artifacts/${{ needs.bundle_windows_x86_64.outputs.zed }}/* release-artifacts/Zed-x86_64.exe - mv ./artifacts/${{ needs.bundle_windows_arm64.outputs.zed }}/* release-artifacts/Zed-aarch64.exe - mv ./artifacts/${{ needs.bundle_linux_arm64.outputs.zed }}/* release-artifacts/zed-linux-aarch64.tar.gz - mv ./artifacts/${{ needs.bundle_linux_x86_64.outputs.zed }}/* release-artifacts/zed-linux-x86_64.tar.gz - mv ./artifacts/${{ needs.bundle_linux_x86_64.outputs.remote-server }}/* release-artifacts/zed-remote-server-linux-x86_64.gz - mv ./artifacts/${{ needs.bundle_linux_arm64.outputs.remote-server }}/* release-artifacts/zed-remote-server-linux-aarch64.gz - mv ./artifacts/${{ needs.bundle_mac_x86_64.outputs.remote-server }}/* release-artifacts/zed-remote-server-macos-x86_64.gz - mv ./artifacts/${{ needs.bundle_mac_arm64.outputs.remote-server }}/* release-artifacts/zed-remote-server-macos-aarch64.gz + mv ./artifacts/Zed-aarch64.dmg/Zed-aarch64.dmg release-artifacts/Zed-aarch64.dmg + mv ./artifacts/Zed-x86_64.dmg/Zed-x86_64.dmg release-artifacts/Zed-x86_64.dmg + mv ./artifacts/zed-linux-aarch64.tar.gz/zed-linux-aarch64.tar.gz release-artifacts/zed-linux-aarch64.tar.gz + mv ./artifacts/zed-linux-x86_64.tar.gz/zed-linux-x86_64.tar.gz release-artifacts/zed-linux-x86_64.tar.gz + mv ./artifacts/Zed-x86_64.exe/Zed-x86_64.exe release-artifacts/Zed-x86_64.exe + mv ./artifacts/Zed-aarch64.exe/Zed-aarch64.exe release-artifacts/Zed-aarch64.exe + mv ./artifacts/zed-remote-server-macos-aarch64.gz/zed-remote-server-macos-aarch64.gz release-artifacts/zed-remote-server-macos-aarch64.gz + mv ./artifacts/zed-remote-server-macos-x86_64.gz/zed-remote-server-macos-x86_64.gz release-artifacts/zed-remote-server-macos-x86_64.gz + mv ./artifacts/zed-remote-server-linux-aarch64.gz/zed-remote-server-linux-aarch64.gz release-artifacts/zed-remote-server-linux-aarch64.gz + mv ./artifacts/zed-remote-server-linux-x86_64.gz/zed-remote-server-linux-x86_64.gz release-artifacts/zed-remote-server-linux-x86_64.gz shell: bash -euxo pipefail {0} - name: gh release upload "$GITHUB_REF_NAME" --repo=zed-industries/zed release-artifacts/* run: gh release upload "$GITHUB_REF_NAME" --repo=zed-industries/zed release-artifacts/* @@ -473,7 +474,7 @@ jobs: shell: bash -euxo pipefail {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: release::auto_release_preview::create_sentry_release + - name: release::create_sentry_release uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c with: environment: production diff --git a/.github/workflows/release_nightly.yml b/.github/workflows/release_nightly.yml index 20230fb499ea9fa892a316bd1762424869004262..f3efe70a498e5718740adca572358c8b7bb81609 100644 --- a/.github/workflows/release_nightly.yml +++ b/.github/workflows/release_nightly.yml @@ -3,12 +3,7 @@ name: release_nightly env: CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: '0' RUST_BACKTRACE: '1' - ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} - ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} - DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }} - DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }} on: push: tags: @@ -32,41 +27,6 @@ jobs: run: ./script/clippy shell: bash -euxo pipefail {0} timeout-minutes: 60 - run_tests_mac: - if: github.repository_owner == 'zed-industries' - runs-on: self-mini-macos - steps: - - name: steps::checkout_repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - with: - clean: false - - name: steps::setup_cargo_config - run: | - mkdir -p ./../.cargo - cp ./.cargo/ci-config.toml ./../.cargo/config.toml - shell: bash -euxo pipefail {0} - - name: steps::setup_node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 - with: - node-version: '20' - - name: steps::clippy - run: ./script/clippy - shell: bash -euxo pipefail {0} - - name: steps::cargo_install_nextest - run: cargo install cargo-nextest --locked - shell: bash -euxo pipefail {0} - - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 300 - shell: bash -euxo pipefail {0} - - name: steps::cargo_nextest - run: cargo nextest run --workspace --no-fail-fast --failure-output immediate-final - shell: bash -euxo pipefail {0} - - name: steps::cleanup_cargo_config - if: always() - run: | - rm -rf ./../.cargo - shell: bash -euxo pipefail {0} - timeout-minutes: 60 run_tests_windows: if: github.repository_owner == 'zed-industries' runs-on: self-32vcpu-windows-2022 @@ -102,55 +62,109 @@ jobs: Remove-Item -Recurse -Path "./../.cargo" -Force -ErrorAction SilentlyContinue shell: pwsh timeout-minutes: 60 - bundle_mac_nightly_x86_64: + bundle_linux_aarch64: needs: - check_style - - run_tests_mac - if: github.repository_owner == 'zed-industries' - runs-on: self-mini-macos + - run_tests_windows + runs-on: namespace-profile-8x32-ubuntu-2004-arm-m4 env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} - APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} - APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} - APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 - with: - node-version: '20' + - name: run_bundling::set_release_channel_to_nightly + run: | + set -eu + version=$(git rev-parse --short HEAD) + echo "Publishing version: ${version} on release channel nightly" + echo "nightly" > crates/zed/RELEASE_CHANNEL + shell: bash -euxo pipefail {0} - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 300 + - name: steps::setup_linux + run: ./script/linux + shell: bash -euxo pipefail {0} + - name: steps::install_mold + run: ./script/install-mold shell: bash -euxo pipefail {0} - - name: release_nightly::set_release_channel_to_nightly + - name: ./script/bundle-linux + run: ./script/bundle-linux + shell: bash -euxo pipefail {0} + - name: '@actions/upload-artifact zed-linux-aarch64.tar.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-linux-aarch64.tar.gz + path: target/release/zed-linux-aarch64.tar.gz + if-no-files-found: error + - name: '@actions/upload-artifact zed-remote-server-linux-aarch64.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-remote-server-linux-aarch64.gz + path: target/zed-remote-server-linux-aarch64.gz + if-no-files-found: error + timeout-minutes: 60 + bundle_linux_x86_64: + needs: + - check_style + - run_tests_windows + runs-on: namespace-profile-32x64-ubuntu-2004 + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} + steps: + - name: steps::checkout_repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + with: + clean: false + - name: run_bundling::set_release_channel_to_nightly run: | set -eu version=$(git rev-parse --short HEAD) echo "Publishing version: ${version} on release channel nightly" echo "nightly" > crates/zed/RELEASE_CHANNEL shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac - run: ./script/bundle-mac x86_64-apple-darwin + - name: steps::setup_sentry + uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b + with: + token: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: steps::setup_linux + run: ./script/linux shell: bash -euxo pipefail {0} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly macos x86_64 + - name: steps::install_mold + run: ./script/install-mold + shell: bash -euxo pipefail {0} + - name: ./script/bundle-linux + run: ./script/bundle-linux shell: bash -euxo pipefail {0} + - name: '@actions/upload-artifact zed-linux-x86_64.tar.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-linux-x86_64.tar.gz + path: target/release/zed-linux-x86_64.tar.gz + if-no-files-found: error + - name: '@actions/upload-artifact zed-remote-server-linux-x86_64.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-remote-server-linux-x86_64.gz + path: target/zed-remote-server-linux-x86_64.gz + if-no-files-found: error timeout-minutes: 60 - bundle_mac_nightly_aarch64: + bundle_mac_aarch64: needs: - check_style - - run_tests_mac - if: github.repository_owner == 'zed-industries' + - run_tests_windows runs-on: self-mini-macos env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} @@ -161,6 +175,13 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false + - name: run_bundling::set_release_channel_to_nightly + run: | + set -eu + version=$(git rev-parse --short HEAD) + echo "Publishing version: ${version} on release channel nightly" + echo "nightly" > crates/zed/RELEASE_CHANNEL + shell: bash -euxo pipefail {0} - name: steps::setup_node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: @@ -172,100 +193,84 @@ jobs: - name: steps::clear_target_dir_if_large run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: release_nightly::set_release_channel_to_nightly - run: | - set -eu - version=$(git rev-parse --short HEAD) - echo "Publishing version: ${version} on release channel nightly" - echo "nightly" > crates/zed/RELEASE_CHANNEL - shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac + - name: run_bundling::bundle_mac::bundle_mac run: ./script/bundle-mac aarch64-apple-darwin shell: bash -euxo pipefail {0} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly macos aarch64 - shell: bash -euxo pipefail {0} + - name: '@actions/upload-artifact Zed-aarch64.dmg' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: Zed-aarch64.dmg + path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg + if-no-files-found: error + - name: '@actions/upload-artifact zed-remote-server-macos-aarch64.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-remote-server-macos-aarch64.gz + path: target/zed-remote-server-macos-aarch64.gz + if-no-files-found: error timeout-minutes: 60 - bundle_linux_nightly_x86_64: + bundle_mac_x86_64: needs: - check_style - - run_tests_mac - if: github.repository_owner == 'zed-industries' - runs-on: namespace-profile-32x64-ubuntu-2004 + - run_tests_windows + runs-on: self-mini-macos + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} + APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} + APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} + APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_sentry - uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b - with: - token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: ./script/linux - run: ./script/linux - shell: bash -euxo pipefail {0} - - name: ./script/install-mold - run: ./script/install-mold - shell: bash -euxo pipefail {0} - - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 100 - shell: bash -euxo pipefail {0} - - name: release_nightly::set_release_channel_to_nightly + - name: run_bundling::set_release_channel_to_nightly run: | set -eu version=$(git rev-parse --short HEAD) echo "Publishing version: ${version} on release channel nightly" echo "nightly" > crates/zed/RELEASE_CHANNEL shell: bash -euxo pipefail {0} - - name: ./script/bundle-linux - run: ./script/bundle-linux - shell: bash -euxo pipefail {0} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly linux-targz x86_64 - shell: bash -euxo pipefail {0} - timeout-minutes: 60 - bundle_linux_nightly_aarch64: - needs: - - check_style - - run_tests_mac - if: github.repository_owner == 'zed-industries' - runs-on: namespace-profile-8x32-ubuntu-2004-arm-m4 - steps: - - name: steps::checkout_repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - name: steps::setup_node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: - clean: false + node-version: '20' - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: ./script/linux - run: ./script/linux - shell: bash -euxo pipefail {0} - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 100 - shell: bash -euxo pipefail {0} - - name: release_nightly::set_release_channel_to_nightly - run: | - set -eu - version=$(git rev-parse --short HEAD) - echo "Publishing version: ${version} on release channel nightly" - echo "nightly" > crates/zed/RELEASE_CHANNEL - shell: bash -euxo pipefail {0} - - name: ./script/bundle-linux - run: ./script/bundle-linux + run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly linux-targz aarch64 + - name: run_bundling::bundle_mac::bundle_mac + run: ./script/bundle-mac x86_64-apple-darwin shell: bash -euxo pipefail {0} + - name: '@actions/upload-artifact Zed-x86_64.dmg' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: Zed-x86_64.dmg + path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg + if-no-files-found: error + - name: '@actions/upload-artifact zed-remote-server-macos-x86_64.gz' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: zed-remote-server-macos-x86_64.gz + path: target/zed-remote-server-macos-x86_64.gz + if-no-files-found: error timeout-minutes: 60 - bundle_windows_nightly_x86_64: + bundle_windows_aarch64: needs: - check_style - run_tests_windows - if: github.repository_owner == 'zed-industries' runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -280,11 +285,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_sentry - uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b - with: - token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: release_nightly::set_release_channel_to_nightly + - name: run_bundling::set_release_channel_to_nightly run: | $ErrorActionPreference = "Stop" $version = git rev-parse --short HEAD @@ -292,22 +293,30 @@ jobs: "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL" shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: run_bundling::bundle_windows - run: script/bundle-windows.ps1 -Architecture x86_64 - shell: pwsh - working-directory: ${{ env.ZED_WORKSPACE }} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly.ps1 -Architecture x86_64 + - name: steps::setup_sentry + uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b + with: + token: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: run_bundling::bundle_windows::bundle_windows + run: script/bundle-windows.ps1 -Architecture aarch64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} + - name: '@actions/upload-artifact Zed-aarch64.exe' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: Zed-aarch64.exe + path: target/Zed-aarch64.exe + if-no-files-found: error timeout-minutes: 60 - bundle_windows_nightly_aarch64: + bundle_windows_x86_64: needs: - check_style - run_tests_windows - if: github.repository_owner == 'zed-industries' runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -322,11 +331,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_sentry - uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b - with: - token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: release_nightly::set_release_channel_to_nightly + - name: run_bundling::set_release_channel_to_nightly run: | $ErrorActionPreference = "Stop" $version = git rev-parse --short HEAD @@ -334,19 +339,25 @@ jobs: "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL" shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: run_bundling::bundle_windows - run: script/bundle-windows.ps1 -Architecture aarch64 - shell: pwsh - working-directory: ${{ env.ZED_WORKSPACE }} - - name: release_nightly::upload_zed_nightly - run: script/upload-nightly.ps1 -Architecture aarch64 + - name: steps::setup_sentry + uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b + with: + token: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: run_bundling::bundle_windows::bundle_windows + run: script/bundle-windows.ps1 -Architecture x86_64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} + - name: '@actions/upload-artifact Zed-x86_64.exe' + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 + with: + name: Zed-x86_64.exe + path: target/Zed-x86_64.exe + if-no-files-found: error timeout-minutes: 60 build_nix_linux_x86_64: needs: - check_style - - run_tests_mac + - run_tests_windows if: github.repository_owner == 'zed-industries' runs-on: namespace-profile-32x64-ubuntu-2004 env: @@ -377,7 +388,7 @@ jobs: build_nix_mac_aarch64: needs: - check_style - - run_tests_mac + - run_tests_windows if: github.repository_owner == 'zed-industries' runs-on: self-mini-macos env: @@ -414,20 +425,48 @@ jobs: continue-on-error: true update_nightly_tag: needs: - - bundle_mac_nightly_x86_64 - - bundle_mac_nightly_aarch64 - - bundle_linux_nightly_x86_64 - - bundle_linux_nightly_aarch64 - - bundle_windows_nightly_x86_64 - - bundle_windows_nightly_aarch64 + - bundle_linux_aarch64 + - bundle_linux_x86_64 + - bundle_mac_aarch64 + - bundle_mac_x86_64 + - bundle_windows_aarch64 + - bundle_windows_x86_64 if: github.repository_owner == 'zed-industries' - runs-on: namespace-profile-2x4-ubuntu-2404 + runs-on: namespace-profile-4x8-ubuntu-2204 steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false fetch-depth: 0 + - name: release::download_workflow_artifacts + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 + with: + path: ./artifacts/ + - name: ls -lR ./artifacts + run: ls -lR ./artifacts + shell: bash -euxo pipefail {0} + - name: release::prep_release_artifacts + run: |- + mkdir -p release-artifacts/ + + mv ./artifacts/Zed-aarch64.dmg/Zed-aarch64.dmg release-artifacts/Zed-aarch64.dmg + mv ./artifacts/Zed-x86_64.dmg/Zed-x86_64.dmg release-artifacts/Zed-x86_64.dmg + mv ./artifacts/zed-linux-aarch64.tar.gz/zed-linux-aarch64.tar.gz release-artifacts/zed-linux-aarch64.tar.gz + mv ./artifacts/zed-linux-x86_64.tar.gz/zed-linux-x86_64.tar.gz release-artifacts/zed-linux-x86_64.tar.gz + mv ./artifacts/Zed-x86_64.exe/Zed-x86_64.exe release-artifacts/Zed-x86_64.exe + mv ./artifacts/Zed-aarch64.exe/Zed-aarch64.exe release-artifacts/Zed-aarch64.exe + mv ./artifacts/zed-remote-server-macos-aarch64.gz/zed-remote-server-macos-aarch64.gz release-artifacts/zed-remote-server-macos-aarch64.gz + mv ./artifacts/zed-remote-server-macos-x86_64.gz/zed-remote-server-macos-x86_64.gz release-artifacts/zed-remote-server-macos-x86_64.gz + mv ./artifacts/zed-remote-server-linux-aarch64.gz/zed-remote-server-linux-aarch64.gz release-artifacts/zed-remote-server-linux-aarch64.gz + mv ./artifacts/zed-remote-server-linux-x86_64.gz/zed-remote-server-linux-x86_64.gz release-artifacts/zed-remote-server-linux-x86_64.gz + shell: bash -euxo pipefail {0} + - name: ./script/upload-nightly + run: ./script/upload-nightly + shell: bash -euxo pipefail {0} + env: + DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }} + DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }} - name: release_nightly::update_nightly_tag_job::update_nightly_tag run: | if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then @@ -439,7 +478,7 @@ jobs: git tag -f nightly git push origin nightly --force shell: bash -euxo pipefail {0} - - name: release_nightly::update_nightly_tag_job::create_sentry_release + - name: release::create_sentry_release uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c with: environment: production diff --git a/.github/workflows/run_bundling.yml b/.github/workflows/run_bundling.yml index a6d563b5b12faa2d5f2cf03b644cfcacbdd17400..5cf10d11f3f9444c9b57f594897dbfa0e435f0b4 100644 --- a/.github/workflows/run_bundling.yml +++ b/.github/workflows/run_bundling.yml @@ -3,192 +3,194 @@ name: run_bundling env: CARGO_TERM_COLOR: always - CARGO_INCREMENTAL: '0' RUST_BACKTRACE: '1' - ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} - ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} on: pull_request: types: - labeled - synchronize jobs: - bundle_mac_x86_64: + bundle_linux_aarch64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: self-mini-macos + runs-on: namespace-profile-8x32-ubuntu-2004-arm-m4 env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} - APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} - APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} - APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 - with: - node-version: '20' - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 300 + - name: steps::setup_linux + run: ./script/linux shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac - run: ./script/bundle-mac x86_64-apple-darwin + - name: steps::install_mold + run: ./script/install-mold shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg' + - name: ./script/bundle-linux + run: ./script/bundle-linux + shell: bash -euxo pipefail {0} + - name: '@actions/upload-artifact zed-linux-aarch64.tar.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg - path: target/x86_64-apple-darwin/release/Zed.dmg + name: zed-linux-aarch64.tar.gz + path: target/release/zed-linux-aarch64.tar.gz if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz' + - name: '@actions/upload-artifact zed-remote-server-linux-aarch64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz - path: target/zed-remote-server-macos-x86_64.gz + name: zed-remote-server-linux-aarch64.gz + path: target/zed-remote-server-linux-aarch64.gz if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-x86_64.gz timeout-minutes: 60 - bundle_mac_arm64: + bundle_linux_x86_64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: self-mini-macos + runs-on: namespace-profile-32x64-ubuntu-2004 env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} - APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} - APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} - APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::setup_node - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 - with: - node-version: '20' - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: steps::clear_target_dir_if_large - run: ./script/clear-target-dir-if-larger-than 300 + - name: steps::setup_linux + run: ./script/linux shell: bash -euxo pipefail {0} - - name: run_bundling::bundle_mac - run: ./script/bundle-mac aarch64-apple-darwin + - name: steps::install_mold + run: ./script/install-mold + shell: bash -euxo pipefail {0} + - name: ./script/bundle-linux + run: ./script/bundle-linux shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg' + - name: '@actions/upload-artifact zed-linux-x86_64.tar.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg - path: target/aarch64-apple-darwin/release/Zed.dmg + name: zed-linux-x86_64.tar.gz + path: target/release/zed-linux-x86_64.tar.gz if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz' + - name: '@actions/upload-artifact zed-remote-server-linux-x86_64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz - path: target/zed-remote-server-macos-aarch64.gz + name: zed-remote-server-linux-x86_64.gz + path: target/zed-remote-server-linux-x86_64.gz if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-macos-aarch64.gz timeout-minutes: 60 - bundle_linux_x86_64: + bundle_mac_aarch64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: namespace-profile-32x64-ubuntu-2004 + runs-on: self-mini-macos + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} + APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} + APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} + APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false + - name: steps::setup_node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: '20' - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: steps::setup_linux - run: ./script/linux - shell: bash -euxo pipefail {0} - - name: steps::install_mold - run: ./script/install-mold + - name: steps::clear_target_dir_if_large + run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: ./script/bundle-linux - run: ./script/bundle-linux + - name: run_bundling::bundle_mac::bundle_mac + run: ./script/bundle-mac aarch64-apple-darwin shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact Zed-aarch64.dmg' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - path: target/release/zed-*.tar.gz + name: Zed-aarch64.dmg + path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-remote-server-macos-aarch64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - path: target/zed-remote-server-*.gz + name: zed-remote-server-macos-aarch64.gz + path: target/zed-remote-server-macos-aarch64.gz if-no-files-found: error - outputs: - zed: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz timeout-minutes: 60 - bundle_linux_arm64: + bundle_mac_x86_64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) - runs-on: namespace-profile-8x32-ubuntu-2004-arm-m4 + runs-on: self-mini-macos + env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} + APPLE_NOTARIZATION_KEY: ${{ secrets.APPLE_NOTARIZATION_KEY }} + APPLE_NOTARIZATION_KEY_ID: ${{ secrets.APPLE_NOTARIZATION_KEY_ID }} + APPLE_NOTARIZATION_ISSUER_ID: ${{ secrets.APPLE_NOTARIZATION_ISSUER_ID }} steps: - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false + - name: steps::setup_node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: '20' - name: steps::setup_sentry uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: steps::setup_linux - run: ./script/linux - shell: bash -euxo pipefail {0} - - name: steps::install_mold - run: ./script/install-mold + - name: steps::clear_target_dir_if_large + run: ./script/clear-target-dir-if-larger-than 300 shell: bash -euxo pipefail {0} - - name: ./script/bundle-linux - run: ./script/bundle-linux + - name: run_bundling::bundle_mac::bundle_mac + run: ./script/bundle-mac x86_64-apple-darwin shell: bash -euxo pipefail {0} - - name: '@actions/upload-artifact zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact Zed-x86_64.dmg' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - path: target/release/zed-*.tar.gz + name: Zed-x86_64.dmg + path: target/x86_64-apple-darwin/release/Zed-x86_64.dmg if-no-files-found: error - - name: '@actions/upload-artifact zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz' + - name: '@actions/upload-artifact zed-remote-server-macos-x86_64.gz' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - path: target/zed-remote-server-*.gz + name: zed-remote-server-macos-x86_64.gz + path: target/zed-remote-server-macos-x86_64.gz if-no-files-found: error - outputs: - zed: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz - remote-server: zed-remote-server-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz timeout-minutes: 60 - bundle_windows_x86_64: + bundle_windows_aarch64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -207,25 +209,26 @@ jobs: uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: run_bundling::bundle_windows - run: script/bundle-windows.ps1 -Architecture x86_64 + - name: run_bundling::bundle_windows::bundle_windows + run: script/bundle-windows.ps1 -Architecture aarch64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe' + - name: '@actions/upload-artifact Zed-aarch64.exe' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe - path: ${{ env.SETUP_PATH }} + name: Zed-aarch64.exe + path: target/Zed-aarch64.exe if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.exe timeout-minutes: 60 - bundle_windows_arm64: + bundle_windows_x86_64: if: |- (github.event.action == 'labeled' && github.event.label.name == 'run-bundling') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-bundling')) runs-on: self-32vcpu-windows-2022 env: + CARGO_INCREMENTAL: 0 + ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} + ZED_MINIDUMP_ENDPOINT: ${{ secrets.ZED_SENTRY_MINIDUMP_ENDPOINT }} AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }} @@ -244,18 +247,16 @@ jobs: uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b with: token: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: run_bundling::bundle_windows - run: script/bundle-windows.ps1 -Architecture aarch64 + - name: run_bundling::bundle_windows::bundle_windows + run: script/bundle-windows.ps1 -Architecture x86_64 shell: pwsh working-directory: ${{ env.ZED_WORKSPACE }} - - name: '@actions/upload-artifact Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe' + - name: '@actions/upload-artifact Zed-x86_64.exe' uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: - name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe - path: ${{ env.SETUP_PATH }} + name: Zed-x86_64.exe + path: target/Zed-x86_64.exe if-no-files-found: error - outputs: - zed: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.exe timeout-minutes: 60 concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} diff --git a/script/bundle-linux b/script/bundle-linux index e41a3d4783d5378409a568e77f74c7f9393576b5..dee60f01e6d1d0ba2624284a3e44c50b35a885c7 100755 --- a/script/bundle-linux +++ b/script/bundle-linux @@ -170,12 +170,7 @@ cp "assets/licenses.md" "${zed_dir}/licenses.md" # Create archive out of everything that's in the temp directory arch=$(uname -m) -target="linux-${arch}" -if [[ "$channel" == "dev" ]]; then - archive="zed-${commit}-${target}.tar.gz" -else - archive="zed-${target}.tar.gz" -fi +archive="zed-linux-${arch}.tar.gz" rm -rf "${archive}" remove_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz" diff --git a/script/bundle-mac b/script/bundle-mac index 901d59f1d011a0ed2b20065bd86739605a81a487..b559768348bccf4db64f1436e9eb970e1fbde014 100755 --- a/script/bundle-mac +++ b/script/bundle-mac @@ -70,12 +70,12 @@ target_triple=${host_line#*: } if [[ $# -gt 0 && -n "$1" ]]; then target_triple="$1" fi -remote_server_arch="" +arch_suffix="" if [[ "$target_triple" = "x86_64-apple-darwin" ]]; then - remote_server_arch="x86_64" + arch_suffix="x86_64" elif [[ "$target_triple" = "aarch64-apple-darwin" ]]; then - remote_server_arch="aarch64" + arch_suffix="aarch64" else echo "Unsupported architecture $target_triple" exit 1 @@ -232,7 +232,7 @@ function sign_app_binaries() { else dmg_target_directory="target/${target_triple}/${target_dir}" dmg_source_directory="${dmg_target_directory}/dmg" - dmg_file_path="${dmg_target_directory}/Zed.dmg" + dmg_file_path="${dmg_target_directory}/Zed-${arch_suffix}.dmg" xcode_bin_dir_path="$(xcode-select -p)/usr/bin" rm -rf ${dmg_source_directory} @@ -310,4 +310,4 @@ cp target/${target_triple}/${target_dir}/cli "${app_path}/Contents/MacOS/cli" sign_app_binaries sign_binary "target/$target_triple/release/remote_server" -gzip -f --stdout --best target/$target_triple/release/remote_server > target/zed-remote-server-macos-$remote_server_arch.gz +gzip -f --stdout --best target/$target_triple/release/remote_server > target/zed-remote-server-macos-$arch_suffix.gz diff --git a/script/upload-nightly b/script/upload-nightly index 985c43936457f53d1db72e4436434aa0ee59296a..abeedc5527520965c7eb5f5714d3d757702711b0 100755 --- a/script/upload-nightly +++ b/script/upload-nightly @@ -1,75 +1,18 @@ #!/usr/bin/env bash -# Based on the template in: https://docs.digitalocean.com/reference/api/spaces-api/ bash -euo pipefail source script/lib/blob-store.sh -allowed_targets=("linux-targz" "macos" "freebsd") -is_allowed_target() { - for val in "${allowed_targets[@]}"; do - if [[ "$1" == "$val" ]]; then - return 0 - fi - done - return 1 -} - -allowed_arch=("x86_64" "aarch64") -is_allowed_arch() { - for val in "${allowed_arch[@]}"; do - if [[ "$1" == "$val" ]]; then - return 0 - fi - done - return 1 -} - -if is_allowed_target "$1"; then - target="$1" -else - echo "Error: Target '$1' is not allowed" - echo "Usage: $0 [${allowed_targets[*]}] {arch}" - exit 1 -fi -if is_allowed_arch "$2"; then - arch="$2" -else - echo "Error: Arch '$2' is not allowed" - echo "Usage: $0 $1 [${allowed_arch[*]}]" - exit 1 -fi -echo "Uploading nightly for target: $target $arch" - bucket_name="zed-nightly-host" -sha=$(git rev-parse HEAD) -echo ${sha} > target/latest-sha -find target -type f -name "zed-remote-server-*.gz" -print0 | while IFS= read -r -d '' file_to_upload; do +for file_to_upload in ./release-artifacts/*; do + [ -f "$file_to_upload" ] || continue upload_to_blob_store $bucket_name "$file_to_upload" "nightly/$(basename "$file_to_upload")" + upload_to_blob_store $bucket_name "$file_to_upload" "${GITHUB_SHA}/$(basename "$file_to_upload")" rm -f "$file_to_upload" done -case "$target" in - macos) - upload_to_blob_store $bucket_name "target/$arch-apple-darwin/release/Zed.dmg" "nightly/Zed-$arch.dmg" - upload_to_blob_store $bucket_name "target/latest-sha" "nightly/latest-sha" - rm -f "target/$arch-apple-darwin/release/Zed.dmg" "target/release/Zed.dmg" - rm -f "target/latest-sha" - ;; - linux-targz) - find . -type f -name "zed-*.tar.gz" -print0 | while IFS= read -r -d '' file_to_upload; do - upload_to_blob_store $bucket_name "$file_to_upload" "nightly/$(basename "$file_to_upload")" - rm -f "$file_to_upload" - done - upload_to_blob_store $bucket_name "target/latest-sha" "nightly/latest-sha-linux-targz" - rm -f "target/latest-sha" - ;; - freebsd) - echo "No freebsd client build (yet)." - ;; - *) - echo "Error: Unknown target '$target'" - exit 1 - ;; -esac +sha=$(git rev-parse HEAD) +echo -n ${sha} > ./release-artifacts/latest-sha +upload_to_blob_store $bucket_name "release-artifacts/latest-sha" "nightly/latest-sha" diff --git a/tooling/xtask/src/tasks/workflows/release.rs b/tooling/xtask/src/tasks/workflows/release.rs index c3d86192fd0e17c268a235292cf24223622094e1..350b8c803a8c2cc40b50a7eae662ccd6da3d3893 100644 --- a/tooling/xtask/src/tasks/workflows/release.rs +++ b/tooling/xtask/src/tasks/workflows/release.rs @@ -1,9 +1,11 @@ use gh_workflow::{Event, Expression, Push, Run, Step, Use, Workflow}; use crate::tasks::workflows::{ - run_bundling, run_tests, runners, - steps::{self, NamedJob, dependant_job, named, release_job}, - vars, + run_bundling::{bundle_linux, bundle_mac, bundle_windows}, + run_tests, + runners::{self, Arch}, + steps::{self, FluentBuilder, NamedJob, dependant_job, named, release_job}, + vars::{self, assets}, }; pub(crate) fn release() -> Workflow { @@ -15,12 +17,12 @@ pub(crate) fn release() -> Workflow { let create_draft_release = create_draft_release(); let bundle = ReleaseBundleJobs { - linux_arm64: bundle_linux_arm64(&[&linux_tests, &check_scripts]), - linux_x86_64: bundle_linux_x86_64(&[&linux_tests, &check_scripts]), - mac_arm64: bundle_mac_arm64(&[&macos_tests, &check_scripts]), - mac_x86_64: bundle_mac_x86_64(&[&macos_tests, &check_scripts]), - windows_arm64: bundle_windows_arm64(&[&windows_tests, &check_scripts]), - windows_x86_64: bundle_windows_x86_64(&[&windows_tests, &check_scripts]), + linux_aarch64: bundle_linux(Arch::AARCH64, None, &[&linux_tests, &check_scripts]), + linux_x86_64: bundle_linux(Arch::X86_64, None, &[&linux_tests, &check_scripts]), + mac_aarch64: bundle_mac(Arch::AARCH64, None, &[&macos_tests, &check_scripts]), + mac_x86_64: bundle_mac(Arch::X86_64, None, &[&macos_tests, &check_scripts]), + windows_aarch64: bundle_windows(Arch::AARCH64, None, &[&windows_tests, &check_scripts]), + windows_x86_64: bundle_windows(Arch::X86_64, None, &[&windows_tests, &check_scripts]), }; let upload_release_assets = upload_release_assets(&[&create_draft_release], &bundle); @@ -31,47 +33,68 @@ pub(crate) fn release() -> Workflow { .on(Event::default().push(Push::default().tags(vec!["v*".to_string()]))) .concurrency(vars::one_workflow_per_non_main_branch()) .add_env(("CARGO_TERM_COLOR", "always")) - .add_env(("CARGO_INCREMENTAL", "0")) .add_env(("RUST_BACKTRACE", "1")) - .add_env(("ZED_CLIENT_CHECKSUM_SEED", vars::ZED_CLIENT_CHECKSUM_SEED)) - .add_env(("ZED_MINIDUMP_ENDPOINT", vars::ZED_SENTRY_MINIDUMP_ENDPOINT)) .add_job(macos_tests.name, macos_tests.job) .add_job(linux_tests.name, linux_tests.job) .add_job(windows_tests.name, windows_tests.job) .add_job(check_scripts.name, check_scripts.job) .add_job(create_draft_release.name, create_draft_release.job) - .add_job(bundle.linux_arm64.name, bundle.linux_arm64.job) - .add_job(bundle.linux_x86_64.name, bundle.linux_x86_64.job) - .add_job(bundle.mac_arm64.name, bundle.mac_arm64.job) - .add_job(bundle.mac_x86_64.name, bundle.mac_x86_64.job) - .add_job(bundle.windows_arm64.name, bundle.windows_arm64.job) - .add_job(bundle.windows_x86_64.name, bundle.windows_x86_64.job) + .map(|mut workflow| { + for job in bundle.into_jobs() { + workflow = workflow.add_job(job.name, job.job); + } + workflow + }) .add_job(upload_release_assets.name, upload_release_assets.job) .add_job(auto_release_preview.name, auto_release_preview.job) } -struct ReleaseBundleJobs { - linux_arm64: NamedJob, - linux_x86_64: NamedJob, - mac_arm64: NamedJob, - mac_x86_64: NamedJob, - windows_arm64: NamedJob, - windows_x86_64: NamedJob, +pub(crate) struct ReleaseBundleJobs { + pub linux_aarch64: NamedJob, + pub linux_x86_64: NamedJob, + pub mac_aarch64: NamedJob, + pub mac_x86_64: NamedJob, + pub windows_aarch64: NamedJob, + pub windows_x86_64: NamedJob, } -fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob { - fn create_sentry_release() -> Step { - named::uses( - "getsentry", - "action-release", - "526942b68292201ac6bbb99b9a0747d4abee354c", // v3 - ) - .add_env(("SENTRY_ORG", "zed-dev")) - .add_env(("SENTRY_PROJECT", "zed")) - .add_env(("SENTRY_AUTH_TOKEN", "${{ secrets.SENTRY_AUTH_TOKEN }}")) - .add_with(("environment", "production")) +impl ReleaseBundleJobs { + pub fn jobs(&self) -> Vec<&NamedJob> { + vec![ + &self.linux_aarch64, + &self.linux_x86_64, + &self.mac_aarch64, + &self.mac_x86_64, + &self.windows_aarch64, + &self.windows_x86_64, + ] } + pub fn into_jobs(self) -> Vec { + vec![ + self.linux_aarch64, + self.linux_x86_64, + self.mac_aarch64, + self.mac_x86_64, + self.windows_aarch64, + self.windows_x86_64, + ] + } +} + +pub(crate) fn create_sentry_release() -> Step { + named::uses( + "getsentry", + "action-release", + "526942b68292201ac6bbb99b9a0747d4abee354c", // v3 + ) + .add_env(("SENTRY_ORG", "zed-dev")) + .add_env(("SENTRY_PROJECT", "zed")) + .add_env(("SENTRY_AUTH_TOKEN", "${{ secrets.SENTRY_AUTH_TOKEN }}")) + .add_with(("environment", "production")) +} + +fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob { named::job( dependant_job(deps) .runs_on(runners::LINUX_SMALL) @@ -92,75 +115,35 @@ fn auto_release_preview(deps: &[&NamedJob; 1]) -> NamedJob { ) } -fn upload_release_assets(deps: &[&NamedJob], bundle_jobs: &ReleaseBundleJobs) -> NamedJob { - fn download_workflow_artifacts() -> Step { - named::uses( - "actions", - "download-artifact", - "018cc2cf5baa6db3ef3c5f8a56943fffe632ef53", // v6.0.0 - ) - .add_with(("path", "./artifacts/")) - } +pub(crate) fn download_workflow_artifacts() -> Step { + named::uses( + "actions", + "download-artifact", + "018cc2cf5baa6db3ef3c5f8a56943fffe632ef53", // v6.0.0 + ) + .add_with(("path", "./artifacts/")) +} - fn prep_release_artifacts(bundle: &ReleaseBundleJobs) -> Step { - let assets = [ - (&bundle.mac_x86_64.name, "zed", "Zed-x86_64.dmg"), - (&bundle.mac_arm64.name, "zed", "Zed-aarch64.dmg"), - (&bundle.windows_x86_64.name, "zed", "Zed-x86_64.exe"), - (&bundle.windows_arm64.name, "zed", "Zed-aarch64.exe"), - (&bundle.linux_arm64.name, "zed", "zed-linux-aarch64.tar.gz"), - (&bundle.linux_x86_64.name, "zed", "zed-linux-x86_64.tar.gz"), - ( - &bundle.linux_x86_64.name, - "remote-server", - "zed-remote-server-linux-x86_64.gz", - ), - ( - &bundle.linux_arm64.name, - "remote-server", - "zed-remote-server-linux-aarch64.gz", - ), - ( - &bundle.mac_x86_64.name, - "remote-server", - "zed-remote-server-macos-x86_64.gz", - ), - ( - &bundle.mac_arm64.name, - "remote-server", - "zed-remote-server-macos-aarch64.gz", - ), - ]; - - let mut script_lines = vec!["mkdir -p release-artifacts/\n".to_string()]; - for (job_name, artifact_kind, release_artifact_name) in assets { - let artifact_path = - ["${{ needs.", job_name, ".outputs.", artifact_kind, " }}"].join(""); - let mv_command = format!( - "mv ./artifacts/{artifact_path}/* release-artifacts/{release_artifact_name}" - ); - script_lines.push(mv_command) - } - - named::bash(&script_lines.join("\n")) +pub(crate) fn prep_release_artifacts() -> Step { + let mut script_lines = vec!["mkdir -p release-artifacts/\n".to_string()]; + for asset in assets::all() { + let mv_command = format!("mv ./artifacts/{asset}/{asset} release-artifacts/{asset}"); + script_lines.push(mv_command) } + named::bash(&script_lines.join("\n")) +} + +fn upload_release_assets(deps: &[&NamedJob], bundle: &ReleaseBundleJobs) -> NamedJob { let mut deps = deps.to_vec(); - deps.extend([ - &bundle_jobs.linux_arm64, - &bundle_jobs.linux_x86_64, - &bundle_jobs.mac_arm64, - &bundle_jobs.mac_x86_64, - &bundle_jobs.windows_arm64, - &bundle_jobs.windows_x86_64, - ]); + deps.extend(bundle.jobs()); named::job( dependant_job(&deps) .runs_on(runners::LINUX_MEDIUM) .add_step(download_workflow_artifacts()) .add_step(steps::script("ls -lR ./artifacts")) - .add_step(prep_release_artifacts(bundle_jobs)) + .add_step(prep_release_artifacts()) .add_step( steps::script("gh release upload \"$GITHUB_REF_NAME\" --repo=zed-industries/zed release-artifacts/*") .add_env(("GITHUB_TOKEN", "${{ secrets.GITHUB_TOKEN }}")), @@ -199,25 +182,3 @@ fn create_draft_release() -> NamedJob { .add_step(create_release()), ) } - -fn bundle_mac_x86_64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_mac_job(runners::Arch::X86_64, deps)) -} -fn bundle_mac_arm64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_mac_job(runners::Arch::ARM64, deps)) -} -fn bundle_linux_x86_64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_linux_job(runners::Arch::X86_64, deps)) -} -fn bundle_linux_arm64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_linux_job(runners::Arch::ARM64, deps)) -} -fn bundle_windows_x86_64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_windows_job( - runners::Arch::X86_64, - deps, - )) -} -fn bundle_windows_arm64(deps: &[&NamedJob]) -> NamedJob { - named::job(run_bundling::bundle_windows_job(runners::Arch::ARM64, deps)) -} diff --git a/tooling/xtask/src/tasks/workflows/release_nightly.rs b/tooling/xtask/src/tasks/workflows/release_nightly.rs index 7079cdbf028c31a27eb9cc230c7c93eb67367680..f557a26f670320a452d83cbc7d48cbabf115b8df 100644 --- a/tooling/xtask/src/tasks/workflows/release_nightly.rs +++ b/tooling/xtask/src/tasks/workflows/release_nightly.rs @@ -1,46 +1,33 @@ use crate::tasks::workflows::{ nix_build::build_nix, - run_bundling::{bundle_mac, bundle_windows}, + release::{ + ReleaseBundleJobs, create_sentry_release, download_workflow_artifacts, + prep_release_artifacts, + }, + run_bundling::{bundle_linux, bundle_mac, bundle_windows}, run_tests::run_platform_tests, - runners::{Arch, Platform}, - steps::NamedJob, - vars::{mac_bundle_envs, windows_bundle_envs}, + runners::{Arch, Platform, ReleaseChannel}, + steps::{FluentBuilder, NamedJob}, }; use super::{runners, steps, steps::named, vars}; use gh_workflow::*; -use indexmap::IndexMap; /// Generates the release_nightly.yml workflow pub fn release_nightly() -> Workflow { - let env: IndexMap<_, _> = [ - ("CARGO_TERM_COLOR", "always"), - ("CARGO_INCREMENTAL", "0"), - ("RUST_BACKTRACE", "1"), - ("ZED_CLIENT_CHECKSUM_SEED", vars::ZED_CLIENT_CHECKSUM_SEED), - ("ZED_MINIDUMP_ENDPOINT", vars::ZED_SENTRY_MINIDUMP_ENDPOINT), - ( - "DIGITALOCEAN_SPACES_ACCESS_KEY", - vars::DIGITALOCEAN_SPACES_ACCESS_KEY, - ), - ( - "DIGITALOCEAN_SPACES_SECRET_KEY", - vars::DIGITALOCEAN_SPACES_SECRET_KEY, - ), - ] - .into_iter() - .map(|(key, value)| (key.into(), value.into())) - .collect(); - let style = check_style(); - let tests = run_platform_tests(Platform::Mac); - let windows_tests = run_platform_tests(Platform::Windows); - let bundle_mac_x86 = bundle_mac_nightly(Arch::X86_64, &[&style, &tests]); - let bundle_mac_arm = bundle_mac_nightly(Arch::ARM64, &[&style, &tests]); - let linux_x86 = bundle_linux_nightly(Arch::X86_64, &[&style, &tests]); - let linux_arm = bundle_linux_nightly(Arch::ARM64, &[&style, &tests]); - let windows_x86 = bundle_windows_nightly(Arch::X86_64, &[&style, &windows_tests]); - let windows_arm = bundle_windows_nightly(Arch::ARM64, &[&style, &windows_tests]); + // run only on windows as that's our fastest platform right now. + let tests = run_platform_tests(Platform::Windows); + let nightly = Some(ReleaseChannel::Nightly); + + let bundle = ReleaseBundleJobs { + linux_aarch64: bundle_linux(Arch::AARCH64, nightly, &[&style, &tests]), + linux_x86_64: bundle_linux(Arch::X86_64, nightly, &[&style, &tests]), + mac_aarch64: bundle_mac(Arch::AARCH64, nightly, &[&style, &tests]), + mac_x86_64: bundle_mac(Arch::X86_64, nightly, &[&style, &tests]), + windows_aarch64: bundle_windows(Arch::AARCH64, nightly, &[&style, &tests]), + windows_x86_64: bundle_windows(Arch::X86_64, nightly, &[&style, &tests]), + }; let nix_linux_x86 = build_nix( Platform::Linux, @@ -51,35 +38,28 @@ pub fn release_nightly() -> Workflow { ); let nix_mac_arm = build_nix( Platform::Mac, - Arch::ARM64, + Arch::AARCH64, "default", None, &[&style, &tests], ); - let update_nightly_tag = update_nightly_tag_job(&[ - &bundle_mac_x86, - &bundle_mac_arm, - &linux_x86, - &linux_arm, - &windows_x86, - &windows_arm, - ]); + let update_nightly_tag = update_nightly_tag_job(&bundle); named::workflow() .on(Event::default() // Fire every day at 7:00am UTC (Roughly before EU workday and after US workday) .schedule([Schedule::new("0 7 * * *")]) .push(Push::default().add_tag("nightly"))) - .envs(env) + .add_env(("CARGO_TERM_COLOR", "always")) + .add_env(("RUST_BACKTRACE", "1")) .add_job(style.name, style.job) .add_job(tests.name, tests.job) - .add_job(windows_tests.name, windows_tests.job) - .add_job(bundle_mac_x86.name, bundle_mac_x86.job) - .add_job(bundle_mac_arm.name, bundle_mac_arm.job) - .add_job(linux_x86.name, linux_x86.job) - .add_job(linux_arm.name, linux_arm.job) - .add_job(windows_x86.name, windows_x86.job) - .add_job(windows_arm.name, windows_arm.job) + .map(|mut workflow| { + for job in bundle.into_jobs() { + workflow = workflow.add_job(job.name, job.job); + } + workflow + }) .add_job(nix_linux_x86.name, nix_linux_x86.job) .add_job(nix_mac_arm.name, nix_mac_arm.job) .add_job(update_nightly_tag.name, update_nightly_tag.job) @@ -112,62 +92,7 @@ fn release_job(deps: &[&NamedJob]) -> Job { } } -fn bundle_mac_nightly(arch: Arch, deps: &[&NamedJob]) -> NamedJob { - let platform = Platform::Mac; - NamedJob { - name: format!("bundle_mac_nightly_{arch}"), - job: release_job(deps) - .runs_on(runners::MAC_DEFAULT) - .envs(mac_bundle_envs()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_node()) - .add_step(steps::setup_sentry()) - .add_step(steps::clear_target_dir_if_large(platform)) - .add_step(set_release_channel_to_nightly(platform)) - .add_step(bundle_mac(arch)) - .add_step(upload_zed_nightly(platform, arch)), - } -} - -fn bundle_linux_nightly(arch: Arch, deps: &[&NamedJob]) -> NamedJob { - let platform = Platform::Linux; - let mut job = steps::release_job(deps) - .runs_on(arch.linux_bundler()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_sentry()) - .add_step(steps::script("./script/linux")); - - // todo(ci) can we do this on arm too? - if arch == Arch::X86_64 { - job = job.add_step(steps::script("./script/install-mold")); - } - job = job - .add_step(steps::clear_target_dir_if_large(platform)) - .add_step(set_release_channel_to_nightly(platform)) - .add_step(steps::script("./script/bundle-linux")) - .add_step(upload_zed_nightly(platform, arch)); - NamedJob { - name: format!("bundle_linux_nightly_{arch}"), - job, - } -} - -fn bundle_windows_nightly(arch: Arch, deps: &[&NamedJob]) -> NamedJob { - let platform = Platform::Windows; - NamedJob { - name: format!("bundle_windows_nightly_{arch}"), - job: steps::release_job(deps) - .runs_on(runners::WINDOWS_DEFAULT) - .envs(windows_bundle_envs()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_sentry()) - .add_step(set_release_channel_to_nightly(platform)) - .add_step(bundle_windows(arch)) - .add_step(upload_zed_nightly(platform, arch)), - } -} - -fn update_nightly_tag_job(deps: &[&NamedJob]) -> NamedJob { +fn update_nightly_tag_job(bundle: &ReleaseBundleJobs) -> NamedJob { fn update_nightly_tag() -> Step { named::bash(indoc::indoc! {r#" if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then @@ -181,56 +106,26 @@ fn update_nightly_tag_job(deps: &[&NamedJob]) -> NamedJob { "#}) } - fn create_sentry_release() -> Step { - named::uses( - "getsentry", - "action-release", - "526942b68292201ac6bbb99b9a0747d4abee354c", // v3 - ) - .add_env(("SENTRY_ORG", "zed-dev")) - .add_env(("SENTRY_PROJECT", "zed")) - .add_env(("SENTRY_AUTH_TOKEN", vars::SENTRY_AUTH_TOKEN)) - .add_with(("environment", "production")) - } - NamedJob { name: "update_nightly_tag".to_owned(), - job: steps::release_job(deps) - .runs_on(runners::LINUX_SMALL) + job: steps::release_job(&bundle.jobs()) + .runs_on(runners::LINUX_MEDIUM) .add_step(steps::checkout_repo().add_with(("fetch-depth", 0))) + .add_step(download_workflow_artifacts()) + .add_step(steps::script("ls -lR ./artifacts")) + .add_step(prep_release_artifacts()) + .add_step( + steps::script("./script/upload-nightly") + .add_env(( + "DIGITALOCEAN_SPACES_ACCESS_KEY", + vars::DIGITALOCEAN_SPACES_ACCESS_KEY, + )) + .add_env(( + "DIGITALOCEAN_SPACES_SECRET_KEY", + vars::DIGITALOCEAN_SPACES_SECRET_KEY, + )), + ) .add_step(update_nightly_tag()) .add_step(create_sentry_release()), } } - -fn set_release_channel_to_nightly(platform: Platform) -> Step { - match platform { - Platform::Linux | Platform::Mac => named::bash(indoc::indoc! {r#" - set -eu - version=$(git rev-parse --short HEAD) - echo "Publishing version: ${version} on release channel nightly" - echo "nightly" > crates/zed/RELEASE_CHANNEL - "#}), - Platform::Windows => named::pwsh(indoc::indoc! {r#" - $ErrorActionPreference = "Stop" - $version = git rev-parse --short HEAD - Write-Host "Publishing version: $version on release channel nightly" - "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL" - "#}) - .working_directory("${{ env.ZED_WORKSPACE }}"), - } -} - -fn upload_zed_nightly(platform: Platform, arch: Arch) -> Step { - match platform { - Platform::Linux => named::bash(&format!("script/upload-nightly linux-targz {arch}")), - Platform::Mac => named::bash(&format!("script/upload-nightly macos {arch}")), - Platform::Windows => { - let cmd = match arch { - Arch::X86_64 => "script/upload-nightly.ps1 -Architecture x86_64", - Arch::ARM64 => "script/upload-nightly.ps1 -Architecture aarch64", - }; - named::pwsh(cmd).working_directory("${{ env.ZED_WORKSPACE }}") - } - } -} diff --git a/tooling/xtask/src/tasks/workflows/run_bundling.rs b/tooling/xtask/src/tasks/workflows/run_bundling.rs index be163b215bace76c411145d0ad04d8a9dd7788ca..f01ca4aaa26e8d3e731fdac4f1d77b4b10a39174 100644 --- a/tooling/xtask/src/tasks/workflows/run_bundling.rs +++ b/tooling/xtask/src/tasks/workflows/run_bundling.rs @@ -1,13 +1,24 @@ +use std::path::Path; + use crate::tasks::workflows::{ + release::ReleaseBundleJobs, + runners::{Arch, Platform, ReleaseChannel}, steps::{FluentBuilder, NamedJob, dependant_job, named}, - vars::{mac_bundle_envs, windows_bundle_envs}, + vars::{assets, bundle_envs}, }; -use super::{runners, steps, vars}; +use super::{runners, steps}; use gh_workflow::*; -use indexmap::IndexMap; pub fn run_bundling() -> Workflow { + let bundle = ReleaseBundleJobs { + linux_aarch64: bundle_linux(Arch::AARCH64, None, &[]), + linux_x86_64: bundle_linux(Arch::X86_64, None, &[]), + mac_aarch64: bundle_mac(Arch::AARCH64, None, &[]), + mac_x86_64: bundle_mac(Arch::X86_64, None, &[]), + windows_aarch64: bundle_windows(Arch::AARCH64, None, &[]), + windows_x86_64: bundle_windows(Arch::X86_64, None, &[]), + }; named::workflow() .on(Event::default().pull_request( PullRequest::default().types([PullRequestType::Labeled, PullRequestType::Synchronize]), @@ -19,34 +30,13 @@ pub fn run_bundling() -> Workflow { .cancel_in_progress(true), ) .add_env(("CARGO_TERM_COLOR", "always")) - .add_env(("CARGO_INCREMENTAL", "0")) .add_env(("RUST_BACKTRACE", "1")) - .add_env(("ZED_CLIENT_CHECKSUM_SEED", vars::ZED_CLIENT_CHECKSUM_SEED)) - .add_env(("ZED_MINIDUMP_ENDPOINT", vars::ZED_SENTRY_MINIDUMP_ENDPOINT)) - .add_job( - "bundle_mac_x86_64", - bundle_mac_job(runners::Arch::X86_64, &[]), - ) - .add_job( - "bundle_mac_arm64", - bundle_mac_job(runners::Arch::ARM64, &[]), - ) - .add_job( - "bundle_linux_x86_64", - bundle_linux_job(runners::Arch::X86_64, &[]), - ) - .add_job( - "bundle_linux_arm64", - bundle_linux_job(runners::Arch::ARM64, &[]), - ) - .add_job( - "bundle_windows_x86_64", - bundle_windows_job(runners::Arch::X86_64, &[]), - ) - .add_job( - "bundle_windows_arm64", - bundle_windows_job(runners::Arch::ARM64, &[]), - ) + .map(|mut workflow| { + for job in bundle.into_jobs() { + workflow = workflow.add_job(job.name, job.job); + } + workflow + }) } fn bundle_job(deps: &[&NamedJob]) -> Job { @@ -59,95 +49,145 @@ fn bundle_job(deps: &[&NamedJob]) -> Job { .timeout_minutes(60u32) } -pub(crate) fn bundle_mac_job(arch: runners::Arch, deps: &[&NamedJob]) -> Job { - use vars::GITHUB_SHA; - let artifact_name = format!("Zed_{GITHUB_SHA}-{arch}.dmg"); - let remote_server_artifact_name = format!("zed-remote-server-{GITHUB_SHA}-macos-{arch}.gz"); - bundle_job(deps) - .runs_on(runners::MAC_DEFAULT) - .envs(mac_bundle_envs()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_node()) - .add_step(steps::setup_sentry()) - .add_step(steps::clear_target_dir_if_large(runners::Platform::Mac)) - .add_step(bundle_mac(arch)) - .add_step(steps::upload_artifact( - &artifact_name, - &format!("target/{arch}-apple-darwin/release/Zed.dmg"), - )) - .add_step(steps::upload_artifact( - &remote_server_artifact_name, - &format!("target/zed-remote-server-macos-{arch}.gz"), - )) - .outputs( - [ - ("zed".to_string(), artifact_name), - ("remote-server".to_string(), remote_server_artifact_name), - ] - .into_iter() - .collect::>(), +pub(crate) fn bundle_mac( + arch: Arch, + release_channel: Option, + deps: &[&NamedJob], +) -> NamedJob { + pub fn bundle_mac(arch: Arch) -> Step { + named::bash(&format!("./script/bundle-mac {arch}-apple-darwin")) + } + let platform = Platform::Mac; + let artifact_name = match arch { + Arch::X86_64 => assets::MAC_X86_64, + Arch::AARCH64 => assets::MAC_AARCH64, + }; + let remote_server_artifact_name = match arch { + Arch::X86_64 => assets::REMOTE_SERVER_MAC_X86_64, + Arch::AARCH64 => assets::REMOTE_SERVER_MAC_AARCH64, + }; + NamedJob { + name: format!("bundle_mac_{arch}"), + job: bundle_job(deps) + .runs_on(runners::MAC_DEFAULT) + .envs(bundle_envs(platform)) + .add_step(steps::checkout_repo()) + .when_some(release_channel, |job, release_channel| { + job.add_step(set_release_channel(platform, release_channel)) + }) + .add_step(steps::setup_node()) + .add_step(steps::setup_sentry()) + .add_step(steps::clear_target_dir_if_large(runners::Platform::Mac)) + .add_step(bundle_mac(arch)) + .add_step(upload_artifact(&format!( + "target/{arch}-apple-darwin/release/{artifact_name}" + ))) + .add_step(upload_artifact(&format!( + "target/{remote_server_artifact_name}" + ))), + } +} + +pub fn upload_artifact(path: &str) -> Step { + let name = Path::new(path).file_name().unwrap().to_str().unwrap(); + Step::new(format!("@actions/upload-artifact {}", name)) + .uses( + "actions", + "upload-artifact", + "330a01c490aca151604b8cf639adc76d48f6c5d4", // v5 ) + // N.B. "name" is the name for the asset. The uploaded + // file retains its filename. + .add_with(("name", name)) + .add_with(("path", path)) + .add_with(("if-no-files-found", "error")) } -pub fn bundle_mac(arch: runners::Arch) -> Step { - named::bash(&format!("./script/bundle-mac {arch}-apple-darwin")) +pub(crate) fn bundle_linux( + arch: Arch, + release_channel: Option, + deps: &[&NamedJob], +) -> NamedJob { + let platform = Platform::Linux; + let artifact_name = match arch { + Arch::X86_64 => assets::LINUX_X86_64, + Arch::AARCH64 => assets::LINUX_AARCH64, + }; + let remote_server_artifact_name = match arch { + Arch::X86_64 => assets::REMOTE_SERVER_LINUX_X86_64, + Arch::AARCH64 => assets::REMOTE_SERVER_LINUX_AARCH64, + }; + NamedJob { + name: format!("bundle_linux_{arch}"), + job: bundle_job(deps) + .runs_on(arch.linux_bundler()) + .envs(bundle_envs(platform)) + .add_step(steps::checkout_repo()) + .when_some(release_channel, |job, release_channel| { + job.add_step(set_release_channel(platform, release_channel)) + }) + .add_step(steps::setup_sentry()) + .map(steps::install_linux_dependencies) + .add_step(steps::script("./script/bundle-linux")) + .add_step(upload_artifact(&format!("target/release/{artifact_name}"))) + .add_step(upload_artifact(&format!( + "target/{remote_server_artifact_name}" + ))), + } } -pub(crate) fn bundle_linux_job(arch: runners::Arch, deps: &[&NamedJob]) -> Job { - let artifact_name = format!("zed-{}-{}.tar.gz", vars::GITHUB_SHA, arch.triple()); - let remote_server_artifact_name = format!( - "zed-remote-server-{}-{}.tar.gz", - vars::GITHUB_SHA, - arch.triple() - ); - bundle_job(deps) - .runs_on(arch.linux_bundler()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_sentry()) - .map(steps::install_linux_dependencies) - .add_step(steps::script("./script/bundle-linux")) - .add_step(steps::upload_artifact( - &artifact_name, - "target/release/zed-*.tar.gz", - )) - .add_step(steps::upload_artifact( - &remote_server_artifact_name, - "target/zed-remote-server-*.gz", - )) - .outputs( - [ - ("zed".to_string(), artifact_name), - ("remote-server".to_string(), remote_server_artifact_name), - ] - .into_iter() - .collect::>(), - ) +pub(crate) fn bundle_windows( + arch: Arch, + release_channel: Option, + deps: &[&NamedJob], +) -> NamedJob { + let platform = Platform::Windows; + pub fn bundle_windows(arch: Arch) -> Step { + let step = match arch { + Arch::X86_64 => named::pwsh("script/bundle-windows.ps1 -Architecture x86_64"), + Arch::AARCH64 => named::pwsh("script/bundle-windows.ps1 -Architecture aarch64"), + }; + step.working_directory("${{ env.ZED_WORKSPACE }}") + } + let artifact_name = match arch { + Arch::X86_64 => assets::WINDOWS_X86_64, + Arch::AARCH64 => assets::WINDOWS_AARCH64, + }; + NamedJob { + name: format!("bundle_windows_{arch}"), + job: bundle_job(deps) + .runs_on(runners::WINDOWS_DEFAULT) + .envs(bundle_envs(platform)) + .add_step(steps::checkout_repo()) + .when_some(release_channel, |job, release_channel| { + job.add_step(set_release_channel(platform, release_channel)) + }) + .add_step(steps::setup_sentry()) + .add_step(bundle_windows(arch)) + .add_step(upload_artifact(&format!("target/{artifact_name}"))), + } } -pub(crate) fn bundle_windows_job(arch: runners::Arch, deps: &[&NamedJob]) -> Job { - use vars::GITHUB_SHA; - let artifact_name = format!("Zed_{GITHUB_SHA}-{arch}.exe"); - bundle_job(deps) - .runs_on(runners::WINDOWS_DEFAULT) - .envs(windows_bundle_envs()) - .add_step(steps::checkout_repo()) - .add_step(steps::setup_sentry()) - .add_step(bundle_windows(arch)) - .add_step(steps::upload_artifact( - &artifact_name, - "${{ env.SETUP_PATH }}", - )) - .outputs( - [("zed".to_string(), artifact_name)] - .into_iter() - .collect::>(), - ) +fn set_release_channel(platform: Platform, release_channel: ReleaseChannel) -> Step { + match release_channel { + ReleaseChannel::Nightly => set_release_channel_to_nightly(platform), + } } -pub fn bundle_windows(arch: runners::Arch) -> Step { - let step = match arch { - runners::Arch::X86_64 => named::pwsh("script/bundle-windows.ps1 -Architecture x86_64"), - runners::Arch::ARM64 => named::pwsh("script/bundle-windows.ps1 -Architecture aarch64"), - }; - step.working_directory("${{ env.ZED_WORKSPACE }}") +fn set_release_channel_to_nightly(platform: Platform) -> Step { + match platform { + Platform::Linux | Platform::Mac => named::bash(indoc::indoc! {r#" + set -eu + version=$(git rev-parse --short HEAD) + echo "Publishing version: ${version} on release channel nightly" + echo "nightly" > crates/zed/RELEASE_CHANNEL + "#}), + Platform::Windows => named::pwsh(indoc::indoc! {r#" + $ErrorActionPreference = "Stop" + $version = git rev-parse --short HEAD + Write-Host "Publishing version: $version on release channel nightly" + "nightly" | Set-Content -Path "crates/zed/RELEASE_CHANNEL" + "#}) + .working_directory("${{ env.ZED_WORKSPACE }}"), + } } diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index 88874754706661939490fc470c58d8a0c867c0d8..5c75cb7c9667276190cc93d70ed2e42eca5502c7 100644 --- a/tooling/xtask/src/tasks/workflows/run_tests.rs +++ b/tooling/xtask/src/tasks/workflows/run_tests.rs @@ -65,7 +65,7 @@ pub(crate) fn run_tests() -> Workflow { )), should_build_nix.guard(build_nix( Platform::Mac, - Arch::ARM64, + Arch::AARCH64, "debug", // *don't* cache the built output Some("-zed-editor-[0-9.]*-nightly"), @@ -74,7 +74,7 @@ pub(crate) fn run_tests() -> Workflow { ]; let tests_pass = tests_pass(&jobs); - let mut workflow = named::workflow() + named::workflow() .add_event(Event::default() .push( Push::default() @@ -89,11 +89,14 @@ pub(crate) fn run_tests() -> Workflow { ) .add_env(( "CARGO_TERM_COLOR", "always" )) .add_env(( "RUST_BACKTRACE", 1 )) - .add_env(( "CARGO_INCREMENTAL", 0 )); - for job in jobs { - workflow = workflow.add_job(job.name, job.job) - } - workflow.add_job(tests_pass.name, tests_pass.job) + .add_env(( "CARGO_INCREMENTAL", 0 )) + .map(|mut workflow| { + for job in jobs { + workflow = workflow.add_job(job.name, job.job) + } + workflow + }) + .add_job(tests_pass.name, tests_pass.job) } // Generates a bash script that checks changed files against regex patterns diff --git a/tooling/xtask/src/tasks/workflows/runners.rs b/tooling/xtask/src/tasks/workflows/runners.rs index d001439b175789e709bd733f7660cc3200721d0a..df98826f8afb7dccb3f9e268fe427634caec8dba 100644 --- a/tooling/xtask/src/tasks/workflows/runners.rs +++ b/tooling/xtask/src/tasks/workflows/runners.rs @@ -22,30 +22,23 @@ impl Into for Runner { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Arch { X86_64, - ARM64, + AARCH64, } impl std::fmt::Display for Arch { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Arch::X86_64 => write!(f, "x86_64"), - Arch::ARM64 => write!(f, "aarch64"), + Arch::AARCH64 => write!(f, "aarch64"), } } } impl Arch { - pub fn triple(&self) -> &'static str { - match self { - Arch::X86_64 => "x86_64-unknown-linux-gnu", - Arch::ARM64 => "aarch64-unknown-linux-gnu", - } - } - pub fn linux_bundler(&self) -> Runner { match self { Arch::X86_64 => LINUX_X86_BUNDLER, - Arch::ARM64 => LINUX_ARM_BUNDLER, + Arch::AARCH64 => LINUX_ARM_BUNDLER, } } } @@ -66,3 +59,8 @@ impl std::fmt::Display for Platform { } } } + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum ReleaseChannel { + Nightly, +} diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rs index 5a6196b599ec56b68948afc55316175779877a48..e6de61d381e33e7f6103a51175a78a9d34d9a0be 100644 --- a/tooling/xtask/src/tasks/workflows/steps.rs +++ b/tooling/xtask/src/tasks/workflows/steps.rs @@ -86,18 +86,6 @@ pub fn cleanup_cargo_config(platform: Platform) -> Step { step.if_condition(Expression::new("always()")) } -pub fn upload_artifact(name: &str, path: &str) -> Step { - Step::new(format!("@actions/upload-artifact {}", name)) - .uses( - "actions", - "upload-artifact", - "330a01c490aca151604b8cf639adc76d48f6c5d4", // v5 - ) - .add_with(("name", name)) - .add_with(("path", path)) - .add_with(("if-no-files-found", "error")) -} - pub fn clear_target_dir_if_large(platform: Platform) -> Step { match platform { Platform::Windows => named::pwsh("./script/clear-target-dir-if-larger-than.ps1 250"), diff --git a/tooling/xtask/src/tasks/workflows/vars.rs b/tooling/xtask/src/tasks/workflows/vars.rs index b852e12400098c3d49f806c0010458d123ad24fa..f64d883cf8337131a83d944ea0f744becc6832a7 100644 --- a/tooling/xtask/src/tasks/workflows/vars.rs +++ b/tooling/xtask/src/tasks/workflows/vars.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use gh_workflow::{Concurrency, Env, Expression}; -use crate::tasks::workflows::steps::NamedJob; +use crate::tasks::workflows::{runners::Platform, steps::NamedJob}; macro_rules! secret { ($secret_name:ident) => { @@ -38,28 +38,31 @@ var!(AZURE_SIGNING_ACCOUNT_NAME); var!(AZURE_SIGNING_CERT_PROFILE_NAME); var!(AZURE_SIGNING_ENDPOINT); -pub const GITHUB_SHA: &str = "${{ github.event.pull_request.head.sha || github.sha }}"; +pub fn bundle_envs(platform: Platform) -> Env { + let env = Env::default() + .add("CARGO_INCREMENTAL", 0) + .add("ZED_CLIENT_CHECKSUM_SEED", ZED_CLIENT_CHECKSUM_SEED) + .add("ZED_MINIDUMP_ENDPOINT", ZED_SENTRY_MINIDUMP_ENDPOINT); -pub fn mac_bundle_envs() -> Env { - Env::default() - .add("MACOS_CERTIFICATE", MACOS_CERTIFICATE) - .add("MACOS_CERTIFICATE_PASSWORD", MACOS_CERTIFICATE_PASSWORD) - .add("APPLE_NOTARIZATION_KEY", APPLE_NOTARIZATION_KEY) - .add("APPLE_NOTARIZATION_KEY_ID", APPLE_NOTARIZATION_KEY_ID) - .add("APPLE_NOTARIZATION_ISSUER_ID", APPLE_NOTARIZATION_ISSUER_ID) -} - -pub fn windows_bundle_envs() -> Env { - Env::default() - .add("AZURE_TENANT_ID", AZURE_SIGNING_TENANT_ID) - .add("AZURE_CLIENT_ID", AZURE_SIGNING_CLIENT_ID) - .add("AZURE_CLIENT_SECRET", AZURE_SIGNING_CLIENT_SECRET) - .add("ACCOUNT_NAME", AZURE_SIGNING_ACCOUNT_NAME) - .add("CERT_PROFILE_NAME", AZURE_SIGNING_CERT_PROFILE_NAME) - .add("ENDPOINT", AZURE_SIGNING_ENDPOINT) - .add("FILE_DIGEST", "SHA256") - .add("TIMESTAMP_DIGEST", "SHA256") - .add("TIMESTAMP_SERVER", "http://timestamp.acs.microsoft.com") + match platform { + Platform::Linux => env, + Platform::Mac => env + .add("MACOS_CERTIFICATE", MACOS_CERTIFICATE) + .add("MACOS_CERTIFICATE_PASSWORD", MACOS_CERTIFICATE_PASSWORD) + .add("APPLE_NOTARIZATION_KEY", APPLE_NOTARIZATION_KEY) + .add("APPLE_NOTARIZATION_KEY_ID", APPLE_NOTARIZATION_KEY_ID) + .add("APPLE_NOTARIZATION_ISSUER_ID", APPLE_NOTARIZATION_ISSUER_ID), + Platform::Windows => env + .add("AZURE_TENANT_ID", AZURE_SIGNING_TENANT_ID) + .add("AZURE_CLIENT_ID", AZURE_SIGNING_CLIENT_ID) + .add("AZURE_CLIENT_SECRET", AZURE_SIGNING_CLIENT_SECRET) + .add("ACCOUNT_NAME", AZURE_SIGNING_ACCOUNT_NAME) + .add("CERT_PROFILE_NAME", AZURE_SIGNING_CERT_PROFILE_NAME) + .add("ENDPOINT", AZURE_SIGNING_ENDPOINT) + .add("FILE_DIGEST", "SHA256") + .add("TIMESTAMP_DIGEST", "SHA256") + .add("TIMESTAMP_SERVER", "http://timestamp.acs.microsoft.com"), + } } pub(crate) fn one_workflow_per_non_main_branch() -> Concurrency { @@ -110,3 +113,33 @@ impl PathCondition { } } } + +pub mod assets { + // NOTE: these asset names also exist in the zed.dev codebase. + pub const MAC_AARCH64: &str = "Zed-aarch64.dmg"; + pub const MAC_X86_64: &str = "Zed-x86_64.dmg"; + pub const LINUX_AARCH64: &str = "zed-linux-aarch64.tar.gz"; + pub const LINUX_X86_64: &str = "zed-linux-x86_64.tar.gz"; + pub const WINDOWS_X86_64: &str = "Zed-x86_64.exe"; + pub const WINDOWS_AARCH64: &str = "Zed-aarch64.exe"; + + pub const REMOTE_SERVER_MAC_AARCH64: &str = "zed-remote-server-macos-aarch64.gz"; + pub const REMOTE_SERVER_MAC_X86_64: &str = "zed-remote-server-macos-x86_64.gz"; + pub const REMOTE_SERVER_LINUX_AARCH64: &str = "zed-remote-server-linux-aarch64.gz"; + pub const REMOTE_SERVER_LINUX_X86_64: &str = "zed-remote-server-linux-x86_64.gz"; + + pub fn all() -> Vec<&'static str> { + vec![ + MAC_AARCH64, + MAC_X86_64, + LINUX_AARCH64, + LINUX_X86_64, + WINDOWS_X86_64, + WINDOWS_AARCH64, + REMOTE_SERVER_MAC_AARCH64, + REMOTE_SERVER_MAC_X86_64, + REMOTE_SERVER_LINUX_AARCH64, + REMOTE_SERVER_LINUX_X86_64, + ] + } +}