diff --git a/.github/free_space.sh b/.github/free_space.sh deleted file mode 100644 index 70bef384d..000000000 --- a/.github/free_space.sh +++ /dev/null @@ -1,12 +0,0 @@ -df -h -sudo rm -rf ${GITHUB_WORKSPACE}/.git -sudo rm -rf "$AGENT_TOOLSDIRECTORY" -sudo rm -rf /usr/share/dotnet -sudo apt-get remove -y '^ghc-8.*' -sudo apt-get remove -y '^dotnet-.*' -sudo apt-get remove -y '^llvm-.*' -sudo apt-get remove -y 'php.*' -sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel -sudo apt-get autoremove -y -sudo apt-get clean -df -h diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 440bbc731..10a0cc7ad 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,6 +1,7 @@ # Attempt to backport a merged pull request to the latest stable release # # If the backported PR is succesfully merged +# Any PR without the "breaking" label will be attempted to be backported to the latest stable release name: Backport merged pull request on: diff --git a/.github/workflows/cli_release.yml b/.github/workflows/cli_release.yml deleted file mode 100644 index 544c375a2..000000000 --- a/.github/workflows/cli_release.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Build CLI for Release - -# Will run automatically on every new release -on: - release: - types: [published] - -jobs: - build-and-upload: - permissions: - contents: write - runs-on: ${{ matrix.platform.os }} - strategy: - matrix: - platform: - - { - target: x86_64-pc-windows-msvc, - os: windows-latest, - toolchain: "1.70.0", - } - - { - target: x86_64-apple-darwin, - os: macos-latest, - toolchain: "1.70.0", - } - - { - target: x86_64-unknown-linux-gnu, - os: ubuntu-latest, - toolchain: "1.70.0", - } - steps: - - uses: actions/checkout@v4 - - name: Install stable - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.platform.toolchain }} - targets: ${{ matrix.platform.target }} - - - uses: ilammy/setup-nasm@v1 - - # Setup the Github Actions Cache for the CLI package - - name: Setup cache - uses: Swatinem/rust-cache@v2 - with: - workspaces: packages/cli -> ../../target - - # This neat action can build and upload the binary in one go! - - name: Build and upload binary - uses: taiki-e/upload-rust-binary-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - target: ${{ matrix.platform.target }} - bin: dx - archive: dx-${{ matrix.platform.target }} - checksum: sha256 - manifest_path: packages/cli/Cargo.toml diff --git a/.github/workflows/docs stable.yml b/.github/workflows/docs stable.yml deleted file mode 100644 index 523a24067..000000000 --- a/.github/workflows/docs stable.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: docs stable - -on: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build-deploy: - runs-on: ubuntu-latest - environment: docs - steps: - - # NOTE: Comment out when https://github.com/rust-lang/mdBook/pull/1306 is merged and released - # - name: Setup mdBook - # uses: peaceiris/actions-mdbook@v1 - # with: - # mdbook-version: "0.4.10" - - # NOTE: Delete when the previous one is enabled - - name: Setup mdBook - run: | - cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master - - uses: actions/checkout@v4 - - - name: Build - run: cd docs && - cd guide && mdbook build -d ../nightly/guide && cd .. && - cd router && mdbook build -d ../nightly/router && cd .. - # cd reference && mdbook build -d ../nightly/reference && cd .. && - # cd fermi && mdbook build -d ../nightly/fermi && cd .. - - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.5.0 - with: - branch: gh-pages # The branch the action should deploy to. - folder: docs/nightly # The folder the action should deploy. - target-folder: docs - repository-name: dioxuslabs/docsite - clean: false - token: ${{ secrets.DEPLOY_KEY }} # let's pretend I don't need it for now diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index a9940b0c4..000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Deploy Nightly Docs -on: - push: - branches: - - main - -jobs: - deploy: - name: Build & Deploy - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - run: sudo apt-get update - - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly-2024-02-01 - - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: "true" - save-if: ${{ github.ref == 'refs/heads/main' }} - - uses: ilammy/setup-nasm@v1 - - - name: cargo doc - run: cargo doc --no-deps --workspace --all-features - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4.5.0 - with: - branch: gh-pages - folder: target/doc - target-folder: api-docs/nightly - repository-name: dioxuslabs/docsite - clean: false - token: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9c0cf3c8..c2b3c6c1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,6 @@ jobs: large-packages: false docker-images: false swap-storage: false - - run: cargo make tests fmt: @@ -112,6 +111,27 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' }} - run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings + # Only run semver checks if the PR is not a draft and does not have the breaking label + # Breaking PRs don't need to follow semver since they are breaking changes + # However, this means we won't attempt to backport them, so you should be careful about using this label, as it will + # likely make future backporting difficult + semver: + if: github.event.pull_request.draft == false + if: ${{ !contains(github.event.pull_request.labels.*.name, 'breaking') }} + name: Semver Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ilammy/setup-nasm@v1 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Check semver + uses: obi1kenobi/cargo-semver-checks-action@v2 + - run: cargo semver-checks check-release --workspace --exclude "dioxus-cli, dioxus-ext" + playwright: if: github.event.pull_request.draft == false name: Playwright Tests diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 000000000..37e7e3d9d --- /dev/null +++ b/.github/workflows/promote.yml @@ -0,0 +1,4 @@ +# promote nightly to stable +# +# runs the various git commands to update the version +# should be followed up by a stable release diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b111de50f..000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Release a number of things -# - the extension -# - the CLI -# - nightly docs -# - the website -# - crates themselves - -name: Publish to crates.io - -on: - workflow_dispatch: - inputs: - semver: - type: choice - description: "Semver version to publish" - required: true - options: - - patch - - minor - - major - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - name: Install cargo-workspaces - run: cargo install cargo-workspaces - - name: Login to crates.io - uses: actions-rs/cargo@v1 - with: - toolchain: nightly - command: login - args: ${{ secrets.CRATES_TOKEN }} - - name: Publish to crates.io - run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" - - # Release as-is - # This assumes the version tracking PR has been merged - - # cargo workspaces changed - # # version will automatically commit back to the repo - # # cargo workspaces version -y ${{ github.event.inputs.semver }} - # # publish will automatically commit back to the repo **AND** publish to crates.io - # # cargo workspaces publish -y ${{ github.event.inputs.semver }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..f4031ed9f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,423 @@ +# Release workflow +# +# We parallelize builds, dump all the artifacts into a release, and then publish the release +# This guarantees everything is properly built and cached in case anything goes wrong +# +# The artifacts also need to get pushed to the various places +# - the CLI goes to the releases page for binstall +# - the extension goes to the marketplace +# - the docs go to the website +# +# We need to be aware of the channel we're releasing +# - prerelease is master +# - stable is whatever the latest stable release is (ie 0.4 or 0.5 or 0.6 etc) +# +# In theory, we could trigger this workflow and set the channel accordingly + +on: + workflow_dispatch: + inputs: + channel: + type: choice + description: "Channel to publish" + required: true + description: Publish crates, extension, CLI, and docs + options: + - v0.4.x + - v0.5.x + - main + + # todo: use better name scheme + # - stable # the currently released version of dioxus + # - prerelease # the next version of dioxus, which we release slowly + +jobs: + # Build the CLI for all platforms + build-cli: + permissions: + contents: write + runs-on: ${{ matrix.platform.os }} + strategy: + matrix: + platform: + - { + target: x86_64-pc-windows-msvc, + os: windows-latest, + toolchain: "1.70.0", + } + - { + target: x86_64-apple-darwin, + os: macos-latest, + toolchain: "1.70.0", + } + - { + target: x86_64-unknown-linux-gnu, + os: ubuntu-latest, + toolchain: "1.70.0", + } + steps: + - uses: actions/checkout@v4 + - name: Install stable + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.platform.toolchain }} + targets: ${{ matrix.platform.target }} + - uses: ilammy/setup-nasm@v1 + + # Setup the Github Actions Cache for the CLI package + - name: Setup cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: packages/cli -> ../../target + + # + + # Build the vscode extension + build-extension: + + # Build the docs + build-docs: + + # Run benchmarks, which we'll use to display on the website + build-benchmarks: + + + # And then do the releases, once everything is built + release: + depends-on: [build-cli, build-extension, build-docs, build-benchmarks] + + # Before anything else, we need to publish the crates + - name: Publish to crates.io + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + cargo workspaces publish -y ${{ github.event.inputs.semver }} + + # Todo: we want `cargo install dx` to actually just use a prebuilt binary + - name: Build and upload CLI binaries + uses: taiki-e/upload-rust-binary-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + target: ${{ matrix.platform.target }} + bin: dx + archive: dx-${{ matrix.platform.target }} + checksum: sha256 + manifest_path: packages/cli/Cargo.toml + +# build the docs, CLI, extension, and release +jobs: + build-deploy: + runs-on: ubuntu-latest + environment: docs + steps: + # install rust, etc, with caching, and do some checks + - uses: actions/checkout@v4 + - run: sudo apt-get update + - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.3.1 + with: # speed things up a bit + large-packages: false + docker-images: false + swap-storage: false + + # Just make sure clippy is happy before doing anything else + # Don't publish versions with clippy errors! + - name: Clippy + run: cargo clippy --workspace --all --examples --tests --all-features --all-targets -- -D warnings + + # Build the CLI... todo: do this in a matrix using binstall + - name: Build CLI + run: cargo build --release --bin dx + + - name: Build Extension + run: cargo build --release --bin dx-ext + - name: Bundle extension + working-directory: ./packages/extension + run: vsce package && mv *.vsix ../../dx-ext.vsix + + + # Docs first... + # NOTE: Delete when the previous one is enabled + # NOTE: Comment out when https://github.com/rust-lang/mdBook/pull/1306 is merged and released + # - name: Setup mdBook + # uses: peaceiris/actions-mdbook@v1 + # with: + # mdbook-version: "0.4.10" + - name: Setup mdBook + run: | + cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master + + - name: Build + run: cd docs && + cd guide && mdbook build -d ../nightly/guide && cd .. && + cd router && mdbook build -d ../nightly/router && cd .. + + - name: Deploy docs 🚀 + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + branch: gh-pages # The branch the action should deploy to. + folder: docs/nightly # The folder the action should deploy. + target-folder: docs + repository-name: dioxuslabs/docsite + # Don't clean the existing files, so the old docs are still available. + # todo: the history on the dociste is getting massive, so we should actually just be amending the commit + clean: false + token: ${{ secrets.DEPLOY_KEY }} + + # Then the CLI + + # Then the extension + + # Then the release itself + + +# Release a number of things +# - the extension +# - the CLI +# - nightly docs +# - the website +# - crates themselves + +# name: Publish to crates.io + +# on: +# workflow_dispatch: +# inputs: +# semver: +# type: choice +# description: "Semver version to publish" +# required: true +# options: +# - patch +# - minor +# - major + +# jobs: +# publish: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v2 +# - name: Set up Rust +# uses: actions-rs/toolchain@v1 +# with: +# toolchain: nightly +# override: true +# - name: Install cargo-workspaces +# run: cargo install cargo-workspaces +# - name: Login to crates.io +# uses: actions-rs/cargo@v1 +# with: +# toolchain: nightly +# command: login +# args: ${{ secrets.CRATES_TOKEN }} +# - name: Publish to crates.io +# run: | +# git config --global user.email "github-actions[bot]@users.noreply.github.com" +# git config --global user.name "github-actions[bot]" + +# # Release as-is +# # This assumes the version tracking PR has been merged + +# # cargo workspaces changed +# # # version will automatically commit back to the repo +# # # cargo workspaces version -y ${{ github.event.inputs.semver }} +# Whenever commits are merged to main, update or create a PR that bumps the version +# Tracks if changes are semver compatible +# +# We want to have a standing "major" update PR and a standing "minor" update PR where fixes are backported +# +# Whenever a PR is merged, we want to attempt to update the major/minor bump PRs +# - for main, it's as simple as running cargo workspaces version -y minor and dumping it into a PR +# - for backport, it's a bit more complicated, since we need to know which branch is the latest stable release +# +# - We could make it so merging a PR with a "backport" label attempts to release it, using the target branch as the stable release + +# on: +# push: +# branches: +# - master + + +# # Generate the minor bump +# jobs: +# update_routes: +# runs-on: ubuntu-latest +# steps: +# # Check out the repo, but don't persist credentials, so github uses the GITHUB_TOKEN +# - uses: actions/checkout@v2 +# with: +# persist-credentials: false + +# # Run cargo workspaces version to generate the version bump PR +# - run: "date > datetime.txt" # create or update a test.txt file + +# # And then create the PR +# - uses: gr2m/create-or-update-pull-request-action@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# title: "My pull request title" +# body: "My pull request body" +# branch: "my-pull-request-base-branch" +# path: "lib/" +# commit-message: "My commit message for uncommitted changes in lib/ folder" +# author: "Lorem J. Ipsum " +# labels: label1, label2 +# assignees: user1, user2 +# reviewers: user1, user2 +# team_reviewers: team1, team2 +# auto-merge: squash +# update-pull-request-title-and-body: false + +# # Generate the major bump +# # # # publish will automatically commit back to the repo **AND** publish to crates.io +# # # # cargo workspaces publish -y ${{ github.event.inputs.semver }} + + +# name: Deploy Nightly Docs +# on: +# push: +# branches: +# - main + +# jobs: +# deploy: +# name: Build & Deploy +# runs-on: ubuntu-latest +# permissions: +# contents: write + +# steps: +# - uses: actions/checkout@v4 +# - run: sudo apt-get update +# - run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev +# - uses: dtolnay/rust-toolchain@nightly +# with: +# toolchain: nightly-2024-02-01 +# - uses: Swatinem/rust-cache@v2 +# with: +# cache-all-crates: "true" +# save-if: ${{ github.ref == 'refs/heads/main' }} +# - uses: ilammy/setup-nasm@v1 + +# - name: cargo doc +# run: cargo doc --no-deps --workspace --all-features + +# - name: Deploy +# uses: JamesIves/github-pages-deploy-action@v4.5.0 +# with: +# branch: gh-pages +# folder: target/doc +# target-folder: api-docs/nightly +# repository-name: dioxuslabs/docsite +# clean: false +# token: ${{ secrets.DEPLOY_KEY }} + + +# name: docs stable + +# on: +# workflow_dispatch: + +# concurrency: +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true + +# jobs: +# build-deploy: +# runs-on: ubuntu-latest +# environment: docs +# steps: + +# # NOTE: Comment out when https://github.com/rust-lang/mdBook/pull/1306 is merged and released +# # - name: Setup mdBook +# # uses: peaceiris/actions-mdbook@v1 +# # with: +# # mdbook-version: "0.4.10" + +# # NOTE: Delete when the previous one is enabled +# - name: Setup mdBook +# run: | +# cargo install mdbook --git https://github.com/Demonthos/mdBook.git --branch master +# - uses: actions/checkout@v4 + +# - name: Build +# run: cd docs && +# cd guide && mdbook build -d ../nightly/guide && cd .. && +# cd router && mdbook build -d ../nightly/router && cd .. + +# - name: Deploy 🚀 +# uses: JamesIves/github-pages-deploy-action@v4.5.0 +# with: +# branch: gh-pages # The branch the action should deploy to. +# folder: docs/nightly # The folder the action should deploy. +# target-folder: docs +# repository-name: dioxuslabs/docsite +# clean: false +# token: ${{ secrets.DEPLOY_KEY }} # let's pretend I don't need it for now + + +# name: Build CLI for Release + +# # Will run automatically on every new release +# on: +# release: +# types: [published] + +# jobs: +# build-and-upload: +# permissions: +# contents: write +# runs-on: ${{ matrix.platform.os }} +# strategy: +# matrix: +# platform: +# - { +# target: x86_64-pc-windows-msvc, +# os: windows-latest, +# toolchain: "1.70.0", +# } +# - { +# target: x86_64-apple-darwin, +# os: macos-latest, +# toolchain: "1.70.0", +# } +# - { +# target: x86_64-unknown-linux-gnu, +# os: ubuntu-latest, +# toolchain: "1.70.0", +# } +# steps: +# - uses: actions/checkout@v4 +# - name: Install stable +# uses: dtolnay/rust-toolchain@master +# with: +# toolchain: ${{ matrix.platform.toolchain }} +# targets: ${{ matrix.platform.target }} + +# - uses: ilammy/setup-nasm@v1 + +# # Setup the Github Actions Cache for the CLI package +# - name: Setup cache +# uses: Swatinem/rust-cache@v2 +# with: +# workspaces: packages/cli -> ../../target + +# # This neat action can build and upload the binary in one go! +# - name: Build and upload binary +# uses: taiki-e/upload-rust-binary-action@v1 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# target: ${{ matrix.platform.target }} +# bin: dx +# archive: dx-${{ matrix.platform.target }} +# checksum: sha256 +# manifest_path: packages/cli/Cargo.toml diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml deleted file mode 100644 index 10121ed39..000000000 --- a/.github/workflows/semver.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Whenever commits are merged to main, update or create a PR that bumps the version -# Tracks if changes are semver compatible -# Most likely the changes aren't semver compatible -# -# We want to have a standing "major" update PR and a standing "minor" update PR where fixes are backported -# -# Whenever a PR is made, we want to comment on it: -# - semver compatibility -# - if it's a fix, it should be backported to the minor update PR - -on: - push: - branches: - - master - -# Generate the minor bump -jobs: - update_routes: - runs-on: ubuntu-latest - steps: - # Check out the repo, but don't persist credentials, so github uses the GITHUB_TOKEN - - uses: actions/checkout@v2 - with: - persist-credentials: false - - # Run cargo workspaces version to generate the version bump PR - - run: "date > datetime.txt" # create or update a test.txt file - - # And then create the PR - - uses: gr2m/create-or-update-pull-request-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - title: "My pull request title" - body: "My pull request body" - branch: "my-pull-request-base-branch" - path: "lib/" - commit-message: "My commit message for uncommitted changes in lib/ folder" - author: "Lorem J. Ipsum " - labels: label1, label2 - assignees: user1, user2 - reviewers: user1, user2 - team_reviewers: team1, team2 - auto-merge: squash - update-pull-request-title-and-body: false - -# Generate the major bump diff --git a/.github/workflows/wipe_cache.yml b/.github/workflows/wipe_cache.yml deleted file mode 100644 index 5a78a1e57..000000000 --- a/.github/workflows/wipe_cache.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Clear cache - -on: - workflow_dispatch: - -permissions: - actions: write - -jobs: - clear-cache: - runs-on: ubuntu-latest - steps: - - name: Clear cache - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.cache_controller }} - script: | - console.log("About to clear") - - while (true) { - const caches = await github.rest.actions.getActionsCacheList({ - owner: context.repo.owner, - repo: context.repo.repo - }) - if (caches.data.actions_caches.length === 0) { - break - } - for (const cache of caches.data.actions_caches) { - console.log(cache) - github.rest.actions.deleteActionsCacheById({ - owner: context.repo.owner, - repo: context.repo.repo, - cache_id: cache.id, - }) - } - } - console.log("Clear completed") diff --git a/packages/extension/package.json b/packages/extension/package.json index a60c4d799..f834086da 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -2,14 +2,14 @@ "name": "dioxus", "displayName": "Dioxus", "description": "Useful tools for working with Dioxus", - "version": "0.0.2", + "version": "0.4.0", "publisher": "DioxusLabs", "private": true, "license": "MIT", "icon": "static/icon.png", "repository": { "type": "git", - "url": "https://github.com/DioxusLabs/cli" + "url": "https://github.com/DioxusLabs/dioxus" }, "engines": { "vscode": "^1.68.1"