Skip to content

Commit

Permalink
Merge branch 'main' into remove-provider-from-generator-test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel authored Aug 11, 2024
2 parents 2d05c4d + 478adec commit 186d470
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 8 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ jobs:
RUST_BACKTRACE: "full"

steps:
- name: Cleanup unused stuff
if: runner.os == 'Linux'
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- run: git config --system core.longpaths true
if: runner.os == 'Windows'
- uses: actions/checkout@v4
Expand Down Expand Up @@ -104,6 +123,24 @@ jobs:
env:
RUST_BACKTRACE: "full"
steps:
- name: Cleanup unused stuff
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- uses: actions/checkout@v4
with:
submodules: true
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cleanup unused stuff
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -41,6 +59,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cleanup unused stuff
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
Expand Down Expand Up @@ -149,6 +185,25 @@ jobs:
os: windows-latest

steps:
- name: Cleanup unused stuff
if: runner.os == 'Linux'
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
- run: git config --system core.longpaths true
if: runner.os == 'Windows'
- name: Write release version (non-Windows)
Expand Down
19 changes: 14 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ build-wasm-components:
cargo component build -p pulumi_wasm_example_docker --timings
cargo component build -p pulumi_wasm_example_dependencies --timings
cargo component build -p pulumi_wasm_example_multiple_providers --timings
# DO NOT EDIT - BUILD-WASM-COMPONENTS - START
just build-wasm-providers
cargo build -p pulumi_wasm_runner --timings

# DO NOT EDIT - BUILD-WASM-COMPONENTS - START
build-wasm-providers:
cargo component build \
-p pulumi_wasm_docker_provider \
-p pulumi_wasm_random_provider \
-p pulumi_wasm_cloudflare_provider \
--timings
# DO NOT EDIT - BUILD-WASM-COMPONENTS - END
cargo build -p pulumi_wasm_runner --timings
# DO NOT EDIT - BUILD-WASM-COMPONENTS - END

check:
cargo fmt --all -- --check
Expand Down Expand Up @@ -76,9 +79,15 @@ publish:
cargo publish -p pulumi_wasm_generator_lib --allow-dirty --all-features
cargo publish -p pulumi_wasm_generator --allow-dirty --all-features
cargo publish -p pulumi_wasm_core --allow-dirty --all-features
cargo publish -p pulumi_wasm_docker --allow-dirty --all-features
cargo publish -p pulumi_wasm_random --allow-dirty --all-features
cargo publish -p pulumi_wasm_runner --allow-dirty --all-features
just publish-providers

# DO NOT EDIT - PUBLISH-PROVIDERS - START
publish-providers:
cargo publish -p pulumi_wasm_docker
cargo publish -p pulumi_wasm_random
cargo publish -p pulumi_wasm_cloudflare
# DO NOT EDIT - PUBLISH-PROVIDERS - END

test:
cargo nextest run --workspace --timings
Expand Down
22 changes: 19 additions & 3 deletions regenerate_providers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fn update_justfile(providers: &[Provider]) {
let content = fs::read_to_string("justfile").expect("Failed to read justfile");
let content = replace_regenerate_providers(providers, &content);
let content = replace_build_wasm_components(providers, &content);
let content = replace_publish_wasm_components(providers, &content);

fs::write("justfile", content).expect("Failed to write to justfile");
}
Expand All @@ -86,16 +87,31 @@ fn replace_regenerate_providers(providers: &[Provider], content: &str) -> String

fn replace_build_wasm_components(providers: &[Provider], content: &str) -> String {
let mut replacement = String::new();
replacement.push_str("build-wasm-providers:\n");
replacement.push_str(" cargo component build \\\n");
for provider in providers {
replacement.push_str(&format!(
" -p pulumi_wasm_{}_provider \\\n",
provider.name
));
}
replacement.push_str(" --timings\n");
let start_marker =
" # DO NOT EDIT - BUILD-WASM-COMPONENTS - START\n cargo component build \\";
let end_marker = " # DO NOT EDIT - BUILD-WASM-COMPONENTS - END";
let start_marker = "# DO NOT EDIT - BUILD-WASM-COMPONENTS - START";
let end_marker = "# DO NOT EDIT - BUILD-WASM-COMPONENTS - END";
replace_between_markers(content, start_marker, end_marker, &replacement)
}

fn replace_publish_wasm_components(providers: &[Provider], content: &str) -> String {
let mut replacement = String::new();
replacement.push_str("publish-providers:\n");
for provider in providers {
replacement.push_str(&format!(
" cargo publish -p pulumi_wasm_{}\n",
provider.name
));
}
let start_marker = "# DO NOT EDIT - PUBLISH-PROVIDERS - START";
let end_marker = "# DO NOT EDIT - PUBLISH-PROVIDERS - END";
replace_between_markers(content, start_marker, end_marker, &replacement)
}

Expand Down

0 comments on commit 186d470

Please sign in to comment.