dioxus-tw-components 0.2.11

Components made for Dioxus
Documentation
name: Main CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: full

jobs:
    main: 
      name: Main CI
      runs-on: ubuntu-latest

      steps: 
        - uses: actions/checkout@v4
        - name: Install Rust
          uses: dtolnay/rust-toolchain@master
          with:
            toolchain: stable
            targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
        - uses: Swatinem/rust-cache@v2
          with:
            cache-all-crates: "true"
            cache-on-failure: "false"

        - name: Install system dependencies
          uses: awalsh128/cache-apt-pkgs-action@latest
          with:
            packages: build-essential libglib2.0-dev pkg-config libfontconfig1-dev libssl-dev openssl libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
            version: 1.0

        - name: Install rust tools
          run: |
            rustup update
            rustup component add clippy
            rustup component add rustfmt
            cargo install cargo-audit

        - name: Build
          if: always()
          run: cargo build

        #- name: Run tests
        #  if: always()
        #  run: cargo test --all-features

        - name: Run clippy
          if: always()
          run: cargo clippy --all-features -- -D warnings

        - name: Run format
          if: always()
          run: cargo fmt --all -- --check

        - name: Run audit
          if: always()
          run: cargo audit

        - name: Prepare commit message for payload
          if: always()
          env:
            CLEANED_COMMIT_MSG: ${{ github.event.head_commit.message || github.event.pull_request.title }}
          run: |
            set -x
            # Prepare the commit message by passing it through jq to escape all double quotes
            CLEANED_COMMIT_MSG="$(echo $CLEANED_COMMIT_MSG | jq -aRs .)"
            # Add the message to the environment variables for use in the next steps"
            echo "CLEANED_COMMIT_MSG=$CLEANED_COMMIT_MSG" >> $GITHUB_ENV

        - name: Send custom JSON data to Slack workflow
          uses: slackapi/slack-github-action@v1.26.0
          continue-on-error: true
          with:
            payload: |
              {
                "blocks": [
                  {
                    "type": "section",
                    "fields": [
                      {
                        "type": "mrkdwn",
                        "text": "*Actions Status:* ${{ job.status }} ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
                      },
                      {
                        "type": "mrkdwn",
                        "text": "*Repository:* <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
                      }
                    ]
                  },
                  {
                    "type": "section",
                    "fields": [
                      {
                        "type": "mrkdwn",
                        "text": "*Branch:* ${{ github.ref_name }}"
                      },
                      {
                        "type": "mrkdwn",
                        "text": "*Commit:* ${{ env.CLEANED_COMMIT_MSG }}"
                      }
                    ]
                  },
                  {
                    "type": "context",
                    "elements": [
                      {
                        "type": "mrkdwn",
                        "text": "Triggered by: ${{ github.actor }} | Event: ${{ github.event_name }} | <${{ github.event.pull_request.html_url || github.event.head_commit.url }}|View details>"
                      }
                    ]
                  }
                ]
              }
          env:
            SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CICD_WEBHOOK_URL }}
            SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
          if: env.SLACK_WEBHOOK_URL != null