Skip to content

Commit

Permalink
wip: clean up workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelleyrtp committed Feb 22, 2024
1 parent 112b4f9 commit 319eb29
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 475 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/backport.yml

This file was deleted.

26 changes: 5 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Whenever an open PR is updated, the workflow will be triggered
#
# This can get expensive, so we do a lot of caching and checks to prevent unnecessary runs

name: Rust CI
description: Run all the tests and checks for the project

on:
push:
Expand Down Expand Up @@ -255,24 +260,3 @@ jobs:
- name: test
run: |
${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
# Coverage is disabled until we can fix it
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# container:
# image: xd009642/tarpaulin:develop-nightly
# options: --security-opt seccomp=unconfined
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Generate code coverage
# run: |
# apt-get update &&\
# apt-get install build-essential &&\
# apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev -y &&\
# cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v2
# with:
# fail_ci_if_error: false
65 changes: 65 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Runs whenever a PR is merged:
# - attempt to backports fixes
# - upload nightly docs
# - upload nightly CLI builds
# - upload nightly vscode extension
# - upload benchmarks
# - compute coverge
#
# Note that direct commits to master circumvent this workflow!

# - name: Deploy Nightly Docs.rs
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: target/doc
# target-folder: api-docs/nightly
# repository-name: dioxuslabs/docsite
# clean: false
# token: ${{ secrets.DEPLOY_KEY }}

# # 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:
# pull_request_target:
# types: [closed]

# permissions:
# contents: write # so it can comment
# pull-requests: write # so it can create pull requests

# jobs:
# backport:
# name: Backport pull request
# runs-on: ubuntu-latest

# # Don't run on closed unmerged pull requests
# if: github.event.pull_request.merged
# steps:
# - uses: actions/checkout@v4
# - name: Create backport pull requests
# uses: korthout/backport-action@v2
# Coverage is disabled until we can fix it
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# container:
# image: xd009642/tarpaulin:develop-nightly
# options: --security-opt seccomp=unconfined
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Generate code coverage
# run: |
# apt-get update &&\
# apt-get install build-essential &&\
# apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev -y &&\
# cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v2
# with:
# fail_ci_if_error: false
156 changes: 156 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# 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)
#
# It's intended that this workflow is run manually, and only when we're ready to release

on:
workflow_dispatch:
inputs:
channel:
type: choice
description: "Branch to publish"
required: true
description: Choose the branch to publish. If the branch is main, it will publish a patch prerelease.

options:
- main
- v0.4.x
- v0.5.x
- v0.6.x
# todo: more stable releases as time goes on

env:
# make sure we have the right semver.
# main is always a prepatch until we hit 1.0, and then this script needs to be updated
# note that we need to promote the prepatch to a minor bump when we actually do a release
# this means the version in git will always be one minor bump ahead of the actual release - basically meaning once
# we release a version, it's fair game to merge breaking changes to main since all semver-compatible changes will be
# backported automatically
SEMVER: ${{ github.event.inputs.channel == 'main' && 'prepatch' || 'patch' }}
PRERELEASE_TAG: ${{ github.event.inputs.channel == 'main' && '-prerelease' || '' }}

jobs:
# First, run checks (clippy, tests, etc) and then publish the crates to crates.io
release-crates:
steps:
# Checkout the right branch, and the nightly stuff
- uses: actions/checkout@v4
ref: ${{ github.event.inputs.channel }}
- 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"
- uses: ilammy/setup-nasm@v1

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
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 docs here too before publishing, to ensure they're up to date
- name: cargo doc
run: RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --workspace --all-features

- 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 version -y ${{ env.SEMVER }} --no-git-commit
# todo: actually just publish!
# cargo workspaces publish -y ${{ github.event.inputs.semver }}
# this will be more useful when we publish the website with updated docs
# Build the docs.rs docs and publish them to the website under the right folder
# v0.4.x -> docs/0.4
# v0.5.x -> docs/0.5 etc
# main -> docs/nightly
# strip the v from the channel, and the .x from the end, and replace main with nightly
# - name: determine docs folder by channel
# id: determine_docs_folder
# run: echo "::set-output name=folder::$(echo ${{ github.event.inputs.channel }} | sed 's/v//g' | sed 's/\.x//g' | sed 's/main/nightly/g')"

# Build the CLI for all platforms, uploading the artifacts to our releases page
release-cli:
needs: release-crates
permissions:
contents: write
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aaarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
ref: ${{ github.event.inputs.channel }}

- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.70.0"
targets: ${{ matrix.platform.target }}

- uses: ilammy/setup-nasm@v1

- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/cli -> ../../target

- name: Free Disk Space
uses: jlumbroso/[email protected]
with: # speed things up a bit
large-packages: false
docker-images: false
swap-storage: false

# Todo: we want `cargo install dx` to actually just use a prebuilt binary instead of building it
- name: Build and upload CLI binaries
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: dx
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.platform.target }}
archive: dx-${{ matrix.platform.target }}${{ env.PRERELEASE_TAG }}
checksum: sha256
manifest_path: packages/cli/Cargo.toml

# todo: these things
# Run benchmarks, which we'll use to display on the website
# release-benchmarks:
# Build the vscode extension, uploading the artifact to the marketplace
# release-extension:
Loading

0 comments on commit 319eb29

Please sign in to comment.