From b6cb98da4a09dbe358937a61c64791f413a596b7 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:11:16 +1100 Subject: [PATCH 1/7] ci: write rustflags to config.toml in upper directory --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 527e04b..777b8fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,7 @@ name: Build Zed Nightly on: schedule: - cron: "0 0 * * *" # Runs every night at midnight UTC - push: - branches: - - main + workflow_dispatch: jobs: build: @@ -37,6 +35,7 @@ jobs: with: repository: zed-industries/zed ref: main + path: zed - name: Install rust nightly uses: dtolnay/rust-toolchain@stable @@ -50,20 +49,26 @@ jobs: with: key: ${{ matrix.backend }} + - name: Setup rustflags + run: | + mkdir .cargo + echo "[target.'cfg(all())']" > .cargo/config.toml + echo "rustflags = [\"${{ matrix.rustflags }}\"]" >> .cargo/config.toml + - name: Build release - env: - RUSTFLAGS: ${{ matrix.rustflags }} + working-directory: zed run: cargo build --release - name: Archive build uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact_name }} - path: target/release/zed.exe + path: zed/target/release/zed.exe release: needs: build runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' permissions: contents: write @@ -94,4 +99,4 @@ jobs: make_latest: true files: | zed-windows.zip - zed-windows-opengl.zip \ No newline at end of file + zed-windows-opengl.zip From 4dd09ba9318004ac8600ce0a401ecbc8727eb9f1 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:12:30 +1100 Subject: [PATCH 2/7] ci: trigger on push/pull_request --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 777b8fe..e046730 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,8 @@ on: schedule: - cron: "0 0 * * *" # Runs every night at midnight UTC workflow_dispatch: + pull_request: + push: jobs: build: From ac684ac64fc85522a33b4281c61bcfce45801cdb Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:14:45 +1100 Subject: [PATCH 3/7] ci: fix string quotes? --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e046730..271bcec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: run: | mkdir .cargo echo "[target.'cfg(all())']" > .cargo/config.toml - echo "rustflags = [\"${{ matrix.rustflags }}\"]" >> .cargo/config.toml + echo 'rustflags = ["${{ matrix.rustflags }}"]' >> .cargo/config.toml - name: Build release working-directory: zed From cde44076513154a74a28824b99ef86552bcdf36b Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:38:43 +1100 Subject: [PATCH 4/7] ci: create powershell script for rustflags --- .github/workflows/build.yml | 5 +---- Parse-Rustflags.ps1 | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 Parse-Rustflags.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 271bcec..c5ec601 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,10 +52,7 @@ jobs: key: ${{ matrix.backend }} - name: Setup rustflags - run: | - mkdir .cargo - echo "[target.'cfg(all())']" > .cargo/config.toml - echo 'rustflags = ["${{ matrix.rustflags }}"]' >> .cargo/config.toml + run: pwsh ./Parse-Rustflags.ps1 ${{ matrix.rustflags }} - name: Build release working-directory: zed diff --git a/Parse-Rustflags.ps1 b/Parse-Rustflags.ps1 new file mode 100644 index 0000000..22cbbfb --- /dev/null +++ b/Parse-Rustflags.ps1 @@ -0,0 +1,19 @@ +$rustflags = $args + +if ($rustflags.Length -eq 0) { + Write-Host "No rustflags provided" + exit 0 +} + +$config_path = ".cargo/config.toml" + +New-Item -Path $config_path -Force | Out-Null + +"[target.'cfg(all())']" | Out-File -FilePath $config_path -Append | Out-Null + +"rustflags = [" | Out-File -FilePath $config_path -Append -NoNewLine | Out-Null +foreach ($flag in $rustflags) { + $line = """${flag}"", " + $line | Out-File -FilePath $config_path -Append -NoNewLine | Out-Null +} +"]" | Out-File -FilePath $config_path -Append | Out-Null From 40924e655d64d2f3c94a940af7042d0e927bd855 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:40:50 +1100 Subject: [PATCH 5/7] ci: add checkout of self --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5ec601..2edf8f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,8 +32,11 @@ jobs: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout self + uses: actions/checkout@v4 + + - name: Checkout Zed + uses: actions/checkout@v4 with: repository: zed-industries/zed ref: main From e443c5e4a894f6f74fe6d2ad7044120e36a51e70 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:41:21 +1100 Subject: [PATCH 6/7] ci: remove push trigger --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2edf8f6..414862e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,6 @@ on: - cron: "0 0 * * *" # Runs every night at midnight UTC workflow_dispatch: pull_request: - push: jobs: build: From 0ebeffe9b7cc43f11521003d55861cea1e29ee01 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 23 Jan 2025 10:43:25 +1100 Subject: [PATCH 7/7] ci: fix rust cache --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 414862e..660eafa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,7 @@ jobs: uses: Swatinem/rust-cache@v2.7.3 with: key: ${{ matrix.backend }} + workspaces: "zed -> target" - name: Setup rustflags run: pwsh ./Parse-Rustflags.ps1 ${{ matrix.rustflags }}