Wire up release_nightly workflow, to upload artifacts to DO spaces

Co-authored-by: Kirill <kirill@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-11-17 14:07:51 -08:00
parent f44f60c6e6
commit c684f08e30
5 changed files with 100 additions and 158 deletions

48
.github/actions/run_tests/action.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: 'Run tests'
description: 'Runs the tests'
runs:
using: "composite"
steps:
- name: Install Rust
shell: bash -euxo pipefail {0}
run: |
rustup set profile minimal
rustup update stable
rustup target add wasm32-wasi
cargo install cargo-nextest
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: Limit target directory size
shell: bash -euxo pipefail {0}
run: script/clear-target-dir-if-larger-than 70
- name: Run check
env:
RUSTFLAGS: -D warnings
shell: bash -euxo pipefail {0}
run: cargo check --test --workspace
- name: Run tests
env:
RUSTFLAGS: -D warnings
shell: bash -euxo pipefail {0}
run: cargo nextest run --workspace --no-fail-fast
- name: Build collab
shell: bash -euxo pipefail {0}
run: cargo build -p collab
- name: Build other binaries
shell: bash -euxo pipefail {0}
run: cargo build --workspace --bins --all-features

21
.github/actions/rust_fmt/action.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: 'Run rustfmt'
description: 'Runs rustfmt'
runs:
using: "composite"
steps:
- name: Install Rust
shell: bash -euxo pipefail {0}
run: |
rustup set profile minimal
rustup update stable
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: cargo fmt
shell: bash -euxo pipefail {0}
run: cargo fmt --all -- --check

View file

@ -23,19 +23,8 @@ jobs:
- self-hosted
- test
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: cargo fmt
run: cargo fmt --all -- --check
- name: Run rustfmt
uses: ./.github/actions/rust_fmt
tests:
name: Run tests
@ -43,41 +32,9 @@ jobs:
- self-hosted
- test
needs: rustfmt
env:
RUSTFLAGS: -D warnings
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
rustup target add wasm32-wasi
cargo install cargo-nextest
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 70
- name: Run check
run: cargo check --workspace
- name: Run tests
run: cargo nextest run --workspace --no-fail-fast
- name: Build collab
run: cargo build -p collab
- name: Build other binaries
run: cargo build --workspace --bins --all-features
uses: ./.github/actions/run_tests
bundle:
name: Bundle app

View file

@ -20,19 +20,8 @@ jobs:
- self-hosted
- test
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: cargo fmt
run: cargo fmt --all -- --check
- name: Run rustfmt
uses: ./.github/actions/rust_fmt
tests:
name: Run tests
@ -40,41 +29,9 @@ jobs:
- self-hosted
- test
needs: rustfmt
env:
RUSTFLAGS: -D warnings
steps:
- name: Install Rust
run: |
rustup set profile minimal
rustup update stable
rustup target add wasm32-wasi
cargo install cargo-nextest
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Checkout repo
uses: actions/checkout@v3
with:
clean: false
submodules: "recursive"
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 70
- name: Run check
run: cargo check --workspace
- name: Run tests
run: cargo nextest run --workspace --no-fail-fast
- name: Build collab
run: cargo build -p collab
- name: Build other binaries
run: cargo build --workspace --bins --all-features
uses: ./.github/actions/run_tests
bundle:
name: Bundle app
@ -87,6 +44,8 @@ jobs:
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
steps:
- name: Install Rust
run: |
@ -110,22 +69,12 @@ jobs:
- name: Limit target directory size
run: script/clear-target-dir-if-larger-than 70
- name: Determine version and release channel
- name: Set release channel to nightly
run: |
set -eu
version=$(git rev-parse --short HEAD)
channel=$(cat crates/zed/RELEASE_CHANNEL)
echo "Publishing version: ${version} on release channel ${channel}"
echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
case ${channel} in
nightly)
exit 0;;
*)
echo "can't publish a release on channel ${channel} with this action"
exit 1;;
esac
echo "Publishing version: ${version} on release channel nightly"
echo "nightly" > crates/zed/RELEASE_CHANNEL
- name: Generate license file
run: script/generate-licenses
@ -133,31 +82,5 @@ jobs:
- name: Create app bundle
run: script/bundle
# So, here's an example of how this _could_ be done.
# Problem: Need to setup some docker secrets
# Problem: This action is very old
# Problem: Need to add stuff for interacting with our API
# - uses: BetaHuhn/do-spaces-action@v2
# name: Upload app bundle to nightly
# id: spaces-upload
# with:
# # Need to put this stuff in kuberenetes I think
# access_key: ${{ secrets.ACCESS_KEY}}
# secret_key: ${{ secrets.SECRET_KEY }}
# space_name: ${{ secrets.SPACE_NAME }}
# space_region: ${{ secrets.SPACE_REGION }}
# source: target/release/Zed.dmg
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Zed Nightly
run: script/upload-nightly #something something
with:
do_secret: ${{ secrets.DO_SPACES_SECRET }}
do_access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }}
# Upload to zed.dev?
- name: Upload new release URL to zed.dev
run: ??? #something something
with:
nightly_release_key: ${{ secrets.NIGHTLY_RELEASE_KEY }}
deployment_url: ${{ steps.spaces-upload.outputs.output_url }}
run: script/upload-nightly