From 78337509cc281d04a0162dde8c2ad34cbe30f573 Mon Sep 17 00:00:00 2001 From: Shannon Tenner Date: Thu, 28 Nov 2024 13:35:38 +0200 Subject: [PATCH] ci: revert workflows split --- .github/workflows/beta_release.yml | 224 ---------- .github/workflows/ci.yml | 276 ++++++------ .github/workflows/lint.yml | 32 +- .github/workflows/pr.yml | 83 ++++ .github/workflows/pr_i18n.yml | 70 --- .github/workflows/pr_signed_commits_check.yml | 19 - .github/workflows/pr_title.yml | 28 -- .github/workflows/release.yml | 417 ++++++++++-------- .prettierrc | 12 +- 9 files changed, 471 insertions(+), 690 deletions(-) delete mode 100644 .github/workflows/beta_release.yml create mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/pr_i18n.yml delete mode 100644 .github/workflows/pr_signed_commits_check.yml delete mode 100644 .github/workflows/pr_title.yml diff --git a/.github/workflows/beta_release.yml b/.github/workflows/beta_release.yml deleted file mode 100644 index 3023bd278..000000000 --- a/.github/workflows/beta_release.yml +++ /dev/null @@ -1,224 +0,0 @@ ---- -name: Beta Release - -on: - push: - paths-ignore: - - '**/*.md' - branches: - - 'beta' - - 'build-*' - -concurrency: - # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix - group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' - cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/main' }} - -permissions: {} - -env: - TS_FEATURES: release-ci-beta - -jobs: - builds: - name: Building ${{ matrix.platform }} (Beta) - permissions: - contents: write - strategy: - fail-fast: false - matrix: - include: - - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. - args: '' - - platform: 'windows-2019' - args: '--bundles msi,nsis,updater' - - platform: 'macos-latest' - args: '--target universal-apple-darwin' - - runs-on: ${{ matrix.platform }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: beta builds - Install dependencies (windows) [yq] - if: ${{ startsWith(runner.os,'Windows') }} - run: | - choco upgrade yq -y - - name: beta builds - Install dependencies (linux) [yq] - if: ${{ startsWith(runner.os,'Linux') }} - shell: bash - run: | - sudo bash ./scripts/check-get-yq.sh - - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Set environment variables for BETA builds - if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }} - env: - BETA_STRING: '(Beta)' - AIRDROP_BASE_URL: ${{ secrets.BETA_AIRDROP_BASE_URL }} - AIRDROP_API_BASE_URL: ${{ secrets.BETA_AIRDROP_API_BASE_URL }} - AIRDROP_TWITTER_AUTH_URL: ${{ secrets.BETA_AIRDROP_TWITTER_AUTH_URL }} - BETA_BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - shell: bash - run: | - #set -xueo pipefail - echo "TARI_NETWORK=esme" >> $GITHUB_ENV - echo "TARI_TARGET_NETWORK=testnet" >> $GITHUB_ENV - echo "AIRDROP_BASE_URL=${{ env.AIRDROP_BASE_URL }}" >> $GITHUB_ENV - echo "AIRDROP_API_BASE_URL=${{ env.AIRDROP_API_BASE_URL }}" >> $GITHUB_ENV - echo "AIRDROP_TWITTER_AUTH_URL=${{ env.AIRDROP_TWITTER_AUTH_URL }}" >> $GITHUB_ENV - echo "TS_FEATURES=release-ci-beta, airdrop-env" >> $GITHUB_ENV - # numeric-only and cannot be greater than 65535 for msi target - export BETA_DATE=$(date +%m%d) - cd "${GITHUB_WORKSPACE}/src-tauri" - echo "releaseName=Tari Universe ${{ env.BETA_STRING }} v__VERSION__-${BETA_DATE}" >> $GITHUB_ENV - # Don't mess with the double quotes and inner escaped quotes - yq eval ".productName = \"Tari Universe ${{ env.BETA_STRING }}\"" -i tauri.conf.json - yq eval ".mainBinaryName = \"Tari Universe ${{ env.BETA_STRING }}\"" -i tauri.conf.json - yq eval ".version += \"-${BETA_DATE}\"" -i tauri.conf.json - yq eval ".bundle.windows.wix.version += \".${BETA_DATE}\"" -i tauri.conf.json - yq eval ".app.windows[0].title = \"Tari Universe ${{ env.BETA_STRING }} | Testnet\"" -i tauri.conf.json - yq eval ".identifier = \"com.tari.universe.beta\"" -i tauri.conf.json - yq eval ".plugins.updater.endpoints = [\"https://raw.githubusercontent.com/tari-project/universe/${{ env.BETA_BRANCH_NAME }}/.updater/beta-latest.json\"]" \ - -i tauri.conf.json - cat tauri.conf.json - sed -i.bak -E "s/^version\s*=\s*\"([0-9]+\.[0-9]+\.[0-9]+)\"/version = \"\1-${BETA_DATE}\"/" \ - Cargo.toml - cat Cargo.toml - sed -i.bak -e "s/\"icons\//\"beta-icons\//g" tauri.conf.json - - name: Node.js setup - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: 'npm' - - - name: Rust setup (linux) - if: startsWith(runner.os,'Linux') - uses: dtolnay/rust-toolchain@stable - env: - RUSTUP_PERMIT_COPY_RENAME: true - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - - - name: Rust setup (macOS) - if: startsWith(runner.os,'macOS') - uses: dtolnay/rust-toolchain@stable - with: - target: aarch64-apple-darwin,x86_64-apple-darwin - - - name: Cache cargo files and outputs - if: ${{ ( ! startsWith(github.ref, 'refs/heads/release') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }} - uses: swatinem/rust-cache@v2 - with: - workspaces: './src-tauri -> target' - - - name: Install dependencies (linux) - if: startsWith(runner.os,'Linux') - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends --assume-yes \ - libwebkit2gtk-4.1-dev \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libprotobuf-dev \ - protobuf-compiler - - - name: Install dependencies (linux/OpenCL) - if: startsWith(runner.os,'Linux') - run: | - sudo apt-get install --no-install-recommends --assume-yes \ - opencl-headers \ - ocl-icd-opencl-dev - - - name: Install dependencies (macOS) - if: startsWith(runner.os,'macOS') - run: | - # openssl, cmake and autoconf already installed - brew install zip coreutils automake protobuf libtool - # force install rust OSX multi-arch components - cd src-tauri - rustup target add x86_64-apple-darwin - rustup target add aarch64-apple-darwin - rustup toolchain install stable-x86_64-apple-darwin --force-non-host - rustup toolchain install stable-aarch64-apple-darwin --force-non-host - - - name: Install dependencies (windows) - if: startsWith(runner.os,'Windows') - run: | - vcpkg.exe install sqlite3:x64-windows zlib:x64-windows - choco upgrade protoc -y - - name: Install dependencies (windows/OpenCL) - if: startsWith(runner.os,'Windows') - run: | - vcpkg.exe --triplet=x64-windows install opencl - - name: Set environment variables (windows) - if: startsWith(runner.os,'Windows') - shell: bash - run: | - echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV - echo "LIB=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV - - name: Azure code-signing setup (windows only) - if: ${{ ( startsWith(runner.os,'Windows') ) && ( env.AZURE_TENANT_ID != '' ) }} - shell: bash - env: - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - WINDOWS_SIGN_COMMAND: trusted-signing-cli -e https://eus.codesigning.azure.net/ -a Tari -c Tarilabs %1 - run: | - cd "${GITHUB_WORKSPACE}/src-tauri" - echo "{}" | \ - jq '.bundle .windows += {"signCommand": "${{ env.WINDOWS_SIGN_COMMAND }}"}' > \ - ./tauri.windows.conf.json - cat ./tauri.windows.conf.json - cargo install trusted-signing-cli@0.3.0 --locked - - name: Install dependencies (node) - run: | - npm --version - npm ci - - - name: Build Tauri apps - id: build - uses: tauri-apps/tauri-action@v0.5.15 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE || secrets.AZURE_TENANT_ID }} - APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - AZURE_TENANT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_TENANT_ID }} - AZURE_CLIENT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_ID }} - AZURE_CLIENT_SECRET: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_SECRET }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - NODE_OPTIONS: '--max_old_space_size=4096' - CACHE_ON_FAILURE: ${{ startsWith(runner.os,'Windows') }} - with: - tagName: ${{ env.tagName }} - releaseName: ${{ env.releaseName }} - releaseBody: 'Tari Universe (BETA) - See the assets to download this version and install' - releaseDraft: true - prerelease: true - includeDebug: false - includeRelease: true - args: ${{ matrix.args }} --features "${{ env.TS_FEATURES }}" - - - name: Debug step {artifactPaths} - continue-on-error: true - shell: bash - run: | - echo "Artifact paths:\n ${{ join(fromJSON(steps.build.outputs.artifactPaths), '\n') }}" - - - name: Upload BETA releases - if: ${{ (steps.build.outputs.artifactPaths) && ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }} - uses: actions/upload-artifact@v4 - with: - name: tari-universe-beta_${{ steps.build.outputs.appVersion }}_${{ matrix.platform }} - path: "${{ join(fromJSON(steps.build.outputs.artifactPaths), '\n') }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f7f55b76..5f324e152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,146 +2,148 @@ name: CI 'on': - workflow_dispatch: - push: - branches: - - 'ci-*' - pull_request: - types: - - opened - - reopened - - synchronize - merge_group: + workflow_dispatch: + push: + branches: + - 'ci-*' + pull_request: + types: + - opened + - reopened + - synchronize + merge_group: concurrency: - # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix - group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' - cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' || github.ref != 'refs/heads/nextnet' || github.ref != 'refs/heads/stagenet' }} + # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' || github.ref != 'refs/heads/nextnet' || github.ref != 'refs/heads/stagenet' }} permissions: {} +defaults: + runs-on: ubuntu-latest + jobs: - cargo-checks: - name: cargo checks (fmt, clippy, check) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: create empty dist dir - run: | - mkdir dist - - name: install dependencies (linux) - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends --assume-yes \ - libwebkit2gtk-4.1-dev \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libprotobuf-dev \ - protobuf-compiler - - - name: install dependencies (linux/OpenCL) - run: | - sudo apt-get install --no-install-recommends --assume-yes \ - opencl-headers \ - ocl-icd-opencl-dev - - - uses: dtolnay/rust-toolchain@stable - with: - components: clippy, rustfmt - - uses: swatinem/rust-cache@v2.7.5 - with: - workspaces: './src-tauri -> target' - - - name: cargo format - working-directory: ./src-tauri - run: | - cargo fmt --all -- --check - - - name: clippy lint - working-directory: ./src-tauri - env: - AIRDROP_BASE_URL: http://localhost:4000 - AIRDROP_API_BASE_URL: http://localhost:3004 - AIRDROP_TWITTER_AUTH_URL: http://localhost:3004/auth/twitter - run: | - cargo install cargo-lints - cargo lints clippy --all-targets --all-features - - name: cargo check - working-directory: ./src-tauri - run: | - cargo check --release --all-targets --workspace - - machete: - name: machete - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: swatinem/rust-cache@v2.7.5 - with: - workspaces: './src-tauri -> target' - - - name: cargo machete - working-directory: ./src-tauri - run: | - cargo install cargo-machete - cargo machete - - tauri-test-build: - strategy: - fail-fast: true - name: tauri-build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: install dependencies (linux) - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends --assume-yes \ - libwebkit2gtk-4.1-dev \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libprotobuf-dev \ - protobuf-compiler - - - name: install dependencies (linux/OpenCL) - run: | - sudo apt-get install --no-install-recommends --assume-yes \ - opencl-headers \ - ocl-icd-opencl-dev - - - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: 'npm' - - name: Install dependencies (node) - run: npm ci - - uses: dtolnay/rust-toolchain@stable - - uses: swatinem/rust-cache@v2.7.5 - with: - workspaces: './src-tauri -> target' - - name: cargo tauri build - working-directory: ./src-tauri - run: | - cargo install tauri-cli --version "^2" --locked - cargo tauri --version - cargo tauri build --ci --bundles deb - - file-licenses: - # disable for now - if: ${{ false }} - name: file-licenses - runs-on: [ubuntu-latest] - steps: - - name: checkout - uses: actions/checkout@v4 - - name: install ripgrep - run: | - # https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb.sha256 - wget -v https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb - sudo dpkg -i ripgrep_14.1.1-1_amd64.deb - rg --version || exit 1 - - name: run the license check - run: ./scripts/file_license_check.sh + cargo-checks: + name: cargo checks (fmt, clippy, check) + steps: + - uses: actions/checkout@v4 + - name: create empty dist dir + run: | + mkdir dist + - name: install dependencies (linux) + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends --assume-yes \ + libwebkit2gtk-4.1-dev \ + libappindicator3-dev \ + librsvg2-dev \ + patchelf \ + libprotobuf-dev \ + protobuf-compiler + + - name: install dependencies (linux/OpenCL) + run: | + sudo apt-get install --no-install-recommends --assume-yes \ + opencl-headers \ + ocl-icd-opencl-dev + + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + - uses: swatinem/rust-cache@v2.7.5 + with: + workspaces: './src-tauri -> target' + + - name: cargo format + working-directory: ./src-tauri + run: | + cargo fmt --all -- --check + + - name: clippy lint + working-directory: ./src-tauri + env: + AIRDROP_BASE_URL: http://localhost:4000 + AIRDROP_API_BASE_URL: http://localhost:3004 + AIRDROP_TWITTER_AUTH_URL: http://localhost:3004/auth/twitter + run: | + cargo install cargo-lints + cargo lints clippy --all-targets --all-features + - name: cargo check + working-directory: ./src-tauri + run: | + cargo check --release --all-targets --workspace + + machete: + name: machete + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: swatinem/rust-cache@v2.7.5 + with: + workspaces: './src-tauri -> target' + + - name: cargo machete + working-directory: ./src-tauri + run: | + cargo install cargo-machete + cargo machete + + tauri-test-build: + strategy: + fail-fast: true + name: tauri-build + + steps: + - uses: actions/checkout@v4 + - name: install dependencies (linux) + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends --assume-yes \ + libwebkit2gtk-4.1-dev \ + libappindicator3-dev \ + librsvg2-dev \ + patchelf \ + libprotobuf-dev \ + protobuf-compiler + + - name: install dependencies (linux/OpenCL) + run: | + sudo apt-get install --no-install-recommends --assume-yes \ + opencl-headers \ + ocl-icd-opencl-dev + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'npm' + - name: Install dependencies (node) + run: npm ci + - uses: dtolnay/rust-toolchain@stable + - uses: swatinem/rust-cache@v2.7.5 + with: + workspaces: './src-tauri -> target' + - name: cargo tauri build + working-directory: ./src-tauri + run: | + cargo install tauri-cli --version "^2" --locked + cargo tauri --version + cargo tauri build --ci --bundles deb + + file-licenses: + # disable for now + if: ${{ false }} + name: file-licenses + + steps: + - name: checkout + uses: actions/checkout@v4 + - name: install ripgrep + run: | + # https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb.sha256 + wget -v https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep_14.1.1-1_amd64.deb + sudo dpkg -i ripgrep_14.1.1-1_amd64.deb + rg --version || exit 1 + - name: run the license check + run: ./scripts/file_license_check.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ece92cf77..0bdff66c1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,20 +2,18 @@ name: Lint on: pull_request jobs: - run-linters: - name: Run linters - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install Node.js dependencies - run: npm ci - - name: check lint/prettier errors - run: npm run lint - - name: check taplo - run: npm run lint:taplo \ No newline at end of file + run-linters: + name: Run linters + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: 'npm' + node-version: lts/* + - name: Install Node.js dependencies + run: npm ci + - name: check lint/prettier errors + run: npm run lint + - name: check taplo + run: npm run lint:taplo diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..4622b6476 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,83 @@ +--- +name: PR +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize + +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' || github.ref != 'refs/heads/nextnet' || github.ref != 'refs/heads/stagenet' }} + +permissions: {} + +defaults: + runs-on: ubuntu-latest + +jobs: + check-signed-commits: + name: Check signed commits + permissions: + contents: read + pull-requests: write + steps: + - uses: 1Password/check-signed-commits-action@v1 + check-title: + name: Check title + steps: + - name: Install Dependencies + run: | + npm install -g @commitlint/cli @commitlint/config-conventional + echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js + - name: Lint Title + env: + PR_TITLE: ${{github.event.pull_request.title}} + run: | + echo "$PR_TITLE" | commitlint + check-i18n: + name: Check i18n + steps: + - uses: actions/checkout@v4 + - name: Install jsonlint + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends --assume-yes \ + python3-demjson + + - name: Basic jsonlint + run: | + find public -iname '*.json' -print0 | \ + xargs -0 -n1 jsonlint -v + + - name: setup folder for logs + run: | + mkdir -p ${{ runner.temp }}/i18n_logs + + - name: i18n compare + continue-on-error: true + working-directory: ./public/locales + run: | + python3 ../../scripts/i18n_checker.py \ + compare --en-locale-path en \ + --base-path . \ + --search-path .. \ + --output-dir ${{ runner.temp }}/i18n_logs + + - name: i18n unused + continue-on-error: true + working-directory: ./public/locales + run: | + python3 ../../scripts/i18n_checker.py \ + unused --en-locale-path en \ + --base-path . \ + --search-path .. \ + --output-dir ${{ runner.temp }}/i18n_logs + + - name: Artifact upload for i18n checks + uses: actions/upload-artifact@v4 + with: + name: i18n-logs + path: ${{ runner.temp }}/i18n_logs diff --git a/.github/workflows/pr_i18n.yml b/.github/workflows/pr_i18n.yml deleted file mode 100644 index c132b6e3e..000000000 --- a/.github/workflows/pr_i18n.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -name: PR - i18n Checks - -'on': - workflow_dispatch: - push: - branches: - - 'ci-*' - pull_request: - types: - - opened - - reopened - - synchronize - merge_group: - -concurrency: - # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix - group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' - cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' || github.ref != 'refs/heads/nextnet' || github.ref != 'refs/heads/stagenet' }} - -permissions: {} - -jobs: - i18n-checks: - name: i18n-checks - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: install jsonlint - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends --assume-yes \ - python3-demjson - - - name: basic jsonlint - run: | - find public -iname '*.json' -print0 | \ - xargs -0 -n1 jsonlint -v - - - name: setup folder for logs - run: | - mkdir -p ${{ runner.temp }}/i18n_logs - - - name: i18n compare - continue-on-error: true - working-directory: ./public/locales - run: | - python3 ../../scripts/i18n_checker.py \ - compare --en-locale-path en \ - --base-path . \ - --search-path .. \ - --output-dir ${{ runner.temp }}/i18n_logs - - - name: i18n unused - continue-on-error: true - working-directory: ./public/locales - run: | - python3 ../../scripts/i18n_checker.py \ - unused --en-locale-path en \ - --base-path . \ - --search-path .. \ - --output-dir ${{ runner.temp }}/i18n_logs - - - name: Artifact upload for i18n checks - uses: actions/upload-artifact@v4 - with: - name: i18n-logs - path: ${{ runner.temp }}/i18n_logs diff --git a/.github/workflows/pr_signed_commits_check.yml b/.github/workflows/pr_signed_commits_check.yml deleted file mode 100644 index 2024a9fb3..000000000 --- a/.github/workflows/pr_signed_commits_check.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# Checks if the comments are signed or not -name: PR - Signed commits check - -'on': - pull_request_target - -permissions: {} - -jobs: - check-signed-commits: - name: Check signed commits in PR - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - name: Check signed commits in PR - uses: 1Password/check-signed-commits-action@v1 diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml deleted file mode 100644 index 23c0688ed..000000000 --- a/.github/workflows/pr_title.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# Checks that PR titles conform to Conventional Commits -# See https://www.conventionalcommits.org/en/v1.0.0/ for more information -name: PR - -'on': - pull_request: - types: - - opened - - reopened - - edited - - synchronize - -permissions: {} - -jobs: - check-title: - runs-on: ubuntu-latest - steps: - - name: install - run: | - npm install -g @commitlint/cli @commitlint/config-conventional - echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js - - name: lint - env: - PR_TITLE: ${{github.event.pull_request.title}} - run: | - echo "$PR_TITLE" | commitlint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 981ab78dd..d7c0eafbe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,203 +1,234 @@ --- name: Release -'on': - push: - paths-ignore: - - '**/*.md' - # tags: - # - 'v[0-9]+.[0-9]+.[0-9]+' - branches: - - 'release' - schedule: - - cron: '05 00 * * *' - workflow_dispatch: +on: + push: + paths-ignore: + - '**/*.md' + branches: + - 'release' + - 'beta' + - 'build-*' + schedule: + - cron: '05 00 * * *' + workflow_dispatch: concurrency: - # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix - group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' - cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/main' || github.ref != 'refs/heads/release' }} - + # https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/main' || github.ref != 'refs/heads/release' }} permissions: {} env: - TS_FEATURES: release-ci + TS_FEATURES: release-ci jobs: - builds: - name: Building ${{ matrix.platform }} - permissions: - contents: write - strategy: - fail-fast: false - matrix: - include: - - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. - args: '' - - platform: 'windows-2019' - args: '--bundles updater, msi' - - platform: 'macos-latest' - args: '--target universal-apple-darwin' - - runs-on: ${{ matrix.platform }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - id: extract_branch - - - name: Set environment variables for RELEASE builds - if: ${{ startsWith(github.ref, 'refs/heads/release') }} - shell: bash - run: | - #set -xueo pipefail - # Setup tauri action envs - echo "tagName=v__VERSION__" >> $GITHUB_ENV - echo "releaseName=Tari Universe v__VERSION__" >> $GITHUB_ENV - #echo "releaseId=" >> $GITHUB_ENV - echo "TARI_NETWORK=nextnet" >> $GITHUB_ENV - echo "TARI_TARGET_NETWORK=nextnet" >> $GITHUB_ENV - cd "${GITHUB_WORKSPACE}/src-tauri" - # Don't mess with the double quotes and inner escaped quotes - yq eval ".productName = \"Tari Universe\"" -i tauri.conf.json - yq eval ".mainBinaryName = \"Tari Universe\"" -i tauri.conf.json - yq eval ".app.windows[0].title = \"Tari Universe | Testnet\"" -i tauri.conf.json - yq eval ".identifier = \"com.tari.universe\"" -i tauri.conf.json - yq eval ".plugins.updater.endpoints = [\"https://raw.githubusercontent.com/tari-project/universe/main/.updater/latest.json\"]" \ - -i tauri.conf.json - - - name: Node.js setup - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: 'npm' - - - name: Rust setup (linux) - if: startsWith(runner.os,'Linux') - uses: dtolnay/rust-toolchain@stable - env: - RUSTUP_PERMIT_COPY_RENAME: true - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - - - name: Rust setup (macOS) - if: startsWith(runner.os,'macOS') - uses: dtolnay/rust-toolchain@stable - with: - target: aarch64-apple-darwin,x86_64-apple-darwin - - - name: Cache cargo files and outputs - if: ${{ ( ! startsWith(github.ref, 'refs/heads/release') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }} - uses: swatinem/rust-cache@v2 - with: - workspaces: './src-tauri -> target' - - - name: Install dependencies (linux) - if: startsWith(runner.os,'Linux') - run: | - sudo apt-get update - sudo apt-get install --no-install-recommends --assume-yes \ - libwebkit2gtk-4.1-dev \ - libappindicator3-dev \ - librsvg2-dev \ - patchelf \ - libprotobuf-dev \ - protobuf-compiler - - - name: Install dependencies (linux/OpenCL) - if: startsWith(runner.os,'Linux') - run: | - sudo apt-get install --no-install-recommends --assume-yes \ - opencl-headers \ - ocl-icd-opencl-dev - - - name: Install dependencies (macOS) - if: startsWith(runner.os,'macOS') - run: | - # openssl, cmake and autoconf already installed - brew install zip coreutils automake protobuf libtool - # force install rust OSX multi-arch components - cd src-tauri - rustup target add x86_64-apple-darwin - rustup target add aarch64-apple-darwin - rustup toolchain install stable-x86_64-apple-darwin --force-non-host - rustup toolchain install stable-aarch64-apple-darwin --force-non-host - - - name: Install dependencies (windows) - if: startsWith(runner.os,'Windows') - run: | - vcpkg.exe install sqlite3:x64-windows zlib:x64-windows - choco upgrade protoc -y - - - name: Install dependencies (windows/OpenCL) - if: startsWith(runner.os,'Windows') - run: | - vcpkg.exe --triplet=x64-windows install opencl - - - name: Set environment variables (windows) - if: startsWith(runner.os,'Windows') - shell: bash - run: | - echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV - echo "LIB=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV - - - name: Azure code-signing setup (windows only) - if: ${{ ( startsWith(runner.os,'Windows') ) && ( env.AZURE_TENANT_ID != '' ) }} - shell: bash - env: - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - WINDOWS_SIGN_COMMAND: trusted-signing-cli -e https://eus.codesigning.azure.net/ -a Tari -c Tarilabs %1 - run: | - cd "${GITHUB_WORKSPACE}/src-tauri" - echo "{}" | \ - jq '.bundle .windows += {"signCommand": "${{ env.WINDOWS_SIGN_COMMAND }}"}' > \ - ./tauri.windows.conf.json - cat ./tauri.windows.conf.json - cargo install trusted-signing-cli@0.3.0 --locked - - - name: Install dependencies (node) - run: | - npm --version - npm install - - - name: Build Tauri apps - id: build - uses: tauri-apps/tauri-action@v0.5.15 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE || secrets.AZURE_TENANT_ID }} - APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - AZURE_TENANT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_TENANT_ID }} - AZURE_CLIENT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_ID }} - AZURE_CLIENT_SECRET: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_SECRET }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - NODE_OPTIONS: '--max_old_space_size=4096' - with: - tagName: ${{ env.tagName }} - releaseName: ${{ env.releaseName }} - releaseBody: 'Tari Universe - See the assets to download this version and install' - # releaseId: ${{ env.releaseId }} - releaseDraft: true - prerelease: true - includeDebug: false - includeRelease: true - args: ${{ matrix.args }} --features "${{ env.TS_FEATURES }}" - - - name: Debug step {artifactPaths} - if: ${{ false }} - continue-on-error: true - env: - artifactPaths: ${{ steps.build.outputs.artifactPaths }} - shell: bash - run: echo "Artifact ID from previous job is $artifactPaths" + builds: + name: Building ${{ matrix.platform }} + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + - platform: 'ubuntu-22.04' + args: '' + - platform: 'windows-latest' + args: '--bundles msi,updater' + - platform: 'macos-latest' + args: '--target universal-apple-darwin' + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + - name: BETA Builds - Install dependencies (windows) [yq] + if: ${{ startsWith(runner.os,'Windows') }} + run: | + choco upgrade yq -y + - name: BETA Builds - Install dependencies (linux) [yq] + if: ${{ startsWith(runner.os,'Linux') }} + shell: bash + run: | + sudo bash ./scripts/check-get-yq.sh + + - name: BETA Builds - Set environment variables + if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }} + env: + BETA_STRING: '(Beta)' + AIRDROP_BASE_URL: ${{ secrets.BETA_AIRDROP_BASE_URL }} + AIRDROP_API_BASE_URL: ${{ secrets.BETA_AIRDROP_API_BASE_URL }} + AIRDROP_TWITTER_AUTH_URL: ${{ secrets.BETA_AIRDROP_TWITTER_AUTH_URL }} + shell: bash + run: | + #set -xueo pipefail + echo "TARI_NETWORK=esme" >> $GITHUB_ENV + echo "TARI_TARGET_NETWORK=testnet" >> $GITHUB_ENV + echo "AIRDROP_BASE_URL=${{ env.AIRDROP_BASE_URL }}" >> $GITHUB_ENV + echo "AIRDROP_API_BASE_URL=${{ env.AIRDROP_API_BASE_URL }}" >> $GITHUB_ENV + echo "AIRDROP_TWITTER_AUTH_URL=${{ env.AIRDROP_TWITTER_AUTH_URL }}" >> $GITHUB_ENV + echo "TS_FEATURES=release-ci-beta, airdrop-env" >> $GITHUB_ENV + # numeric-only and cannot be greater than 65535 for msi target + export BETA_DATE=$(date +%m%d) + cd "${GITHUB_WORKSPACE}/src-tauri" + echo "releaseName=Tari Universe ${{ env.BETA_STRING }} v__VERSION__-${BETA_DATE}" >> $GITHUB_ENV + # Don't mess with the double quotes and inner escaped quotes + yq eval ".productName = \"Tari Universe ${{ env.BETA_STRING }}\"" -i tauri.conf.json + yq eval ".mainBinaryName = \"Tari Universe ${{ env.BETA_STRING }}\"" -i tauri.conf.json + yq eval ".version += \"-${BETA_DATE}\"" -i tauri.conf.json + yq eval ".bundle.windows.wix.version += \".${BETA_DATE}\"" -i tauri.conf.json + yq eval ".app.windows[0].title = \"Tari Universe ${{ env.BETA_STRING }} | Testnet\"" -i tauri.conf.json + yq eval ".identifier = \"com.tari.universe.beta\"" -i tauri.conf.json + yq eval ".plugins.updater.endpoints = [\"https://raw.githubusercontent.com/tari-project/universe/main/.updater/beta-latest.json\"]" \ + -i tauri.conf.json + cat tauri.conf.json + sed -i.bak -E "s/^version\s*=\s*\"([0-9]+\.[0-9]+\.[0-9]+)\"/version = \"\1-${BETA_DATE}\"/" \ + Cargo.toml + cat Cargo.toml + sed -i.bak -e "s/\"icons\//\"beta-icons\//g" tauri.conf.json + - name: RELEASE Builds - Set environment variables + if: ${{ startsWith(github.ref, 'refs/heads/release') }} + shell: bash + run: | + #set -xueo pipefail + # Setup tauri action envs + echo "tagName=v__VERSION__" >> $GITHUB_ENV + echo "releaseName=Tari Universe v__VERSION__" >> $GITHUB_ENV + #echo "releaseId=" >> $GITHUB_ENV + echo "TARI_NETWORK=nextnet" >> $GITHUB_ENV + echo "TARI_TARGET_NETWORK=nextnet" >> $GITHUB_ENV + cd "${GITHUB_WORKSPACE}/src-tauri" + # Don't mess with the double quotes and inner escaped quotes + yq eval ".productName = \"Tari Universe\"" -i tauri.conf.json + yq eval ".mainBinaryName = \"Tari Universe\"" -i tauri.conf.json + yq eval ".app.windows[0].title = \"Tari Universe | Testnet\"" -i tauri.conf.json + yq eval ".identifier = \"com.tari.universe\"" -i tauri.conf.json + yq eval ".plugins.updater.endpoints = [\"https://raw.githubusercontent.com/tari-project/universe/main/.updater/latest.json\"]" \ + -i tauri.conf.json + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'npm' + + - name: Rust Setup + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: Cache Cargo files and outputs + if: ${{ ( ! startsWith(github.ref, 'refs/heads/release') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }} + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + + - name: Install Dependencies - Linux + if: startsWith(runner.os,'Linux') + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends --assume-yes \ + libwebkit2gtk-4.1-dev \ + libappindicator3-dev \ + librsvg2-dev \ + patchelf \ + libprotobuf-dev \ + protobuf-compiler + + - name: Install Dependencies - Linux/OpenCL + if: startsWith(runner.os,'Linux') + run: | + sudo apt-get install --no-install-recommends --assume-yes \ + opencl-headers \ + ocl-icd-opencl-dev + + - name: Install Dependencies - macOS + if: startsWith(runner.os,'macOS') + run: | + # openssl, cmake and autoconf already installed + brew install zip coreutils automake protobuf libtool + # force install rust OSX multi-arch components + cd src-tauri + rustup target add x86_64-apple-darwin + rustup target add aarch64-apple-darwin + rustup toolchain install stable-x86_64-apple-darwin --force-non-host + rustup toolchain install stable-aarch64-apple-darwin --force-non-host + + - name: Install Dependencies - Windows + if: startsWith(runner.os,'Windows') + run: | + vcpkg.exe install sqlite3:x64-windows zlib:x64-windows + choco upgrade protoc -y + + - name: Install Dependencies - Windows/OpenCL + if: startsWith(runner.os,'Windows') + run: | + vcpkg.exe --triplet=x64-windows install opencl + + - name: Set environment variables - Windows + if: startsWith(runner.os,'Windows') + shell: bash + run: | + echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV + echo "LIB=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV + + - name: Azure Code-signing Setup - Windows Only + if: ${{ ( startsWith(runner.os,'Windows') ) && ( env.AZURE_TENANT_ID != '' ) }} + shell: bash + env: + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + WINDOWS_SIGN_COMMAND: trusted-signing-cli -e https://eus.codesigning.azure.net/ -a Tari -c Tarilabs %1 + run: | + cd "${GITHUB_WORKSPACE}/src-tauri" + echo "{}" | \ + jq '.bundle .windows += {"signCommand": "${{ env.WINDOWS_SIGN_COMMAND }}"}' > \ + ./tauri.windows.conf.json + cat ./tauri.windows.conf.json + cargo install trusted-signing-cli@0.3.0 --locked + + - name: Install Dependencies - Node + run: | + npm --version + npm ci + + - name: Build Tauri Apps + id: build + uses: tauri-apps/tauri-action@v0.5.15 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE || secrets.AZURE_TENANT_ID }} + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + AZURE_TENANT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_TENANT_ID }} + AZURE_CLIENT_ID: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_ID }} + AZURE_CLIENT_SECRET: ${{ startsWith(runner.os,'Windows') && secrets.AZURE_CLIENT_SECRET }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + NODE_OPTIONS: '--max_old_space_size=4096' + with: + tagName: ${{ env.tagName }} + releaseName: ${{ env.releaseName }} + releaseBody: 'Tari Universe - See the assets to download this version and install' + releaseDraft: true + prerelease: true + includeDebug: false + includeRelease: true + args: ${{ matrix.args }} --features "${{ env.TS_FEATURES }}" + + - name: Debug Step - artifactPaths + if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }} + continue-on-error: true + env: + artifactPaths: ${{ steps.build.outputs.artifactPaths }} + shell: bash + run: | + echo "Artifact paths:\n ${{ join(fromJSON(steps.build.outputs.artifactPaths), '\n') }}" + + - name: BETA Builds - Upload assets + if: ${{ ( github.event_name == 'schedule' ) || ( ! startsWith(github.ref, 'refs/heads/release') ) }} + uses: actions/upload-artifact@v4 + with: + name: tari-universe-beta_${{ steps.build.outputs.appVersion }}_${{ matrix.platform }} + path: "${{ join(fromJSON(steps.build.outputs.artifactPaths), '\n') }}" diff --git a/.prettierrc b/.prettierrc index 8934690e3..1564a3fb2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,13 @@ "singleQuote": true, "bracketSpacing": true, "printWidth": 120, - "endOfLine": "auto" -} \ No newline at end of file + "endOfLine": "auto", + "overrides": [ + { + "files": "*.yml", + "options": { + "tabWidth": 2 + } + } + ] +}