From 4fca675da711ee9a412dae6442c9de9a2d247b02 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:08:02 +0200 Subject: [PATCH] misc improvements --- .github/workflows/ci.yml | 87 +++++++++++++++++++------------ .github/workflows/deploy-docs.yml | 13 +++-- .github/workflows/release.yml | 80 +++++++++++++++++----------- examples/command.roc | 2 +- 4 files changed, 110 insertions(+), 72 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3eec363a..df1c1c38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,47 +8,62 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +# Do not add permissions here! Configure them at the job level! +permissions: {} + jobs: + rust-version: + name: read Rust version + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.read.outputs.version }} + steps: + - uses: actions/checkout@v7 + - id: read + run: | + version=$(sed -n 's/^channel = "\(.*\)".*/\1/p' rust-toolchain.toml) + echo "version=$version" >> "$GITHUB_OUTPUT" + validate: name: validate sources - runs-on: ubuntu-22.04 - permissions: - contents: read + needs: rust-version + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5 with: version: 0.16.0 - uses: roc-lang/setup-roc@cbe782d6f165b89c87d99f50a59ac4f5f73b4427 # ratchet:roc-lang/setup-roc@v0.3.0 with: version: nightly-new-compiler - - uses: dtolnay/rust-toolchain@1.83.0 - with: - components: llvm-tools-preview - targets: x86_64-unknown-linux-musl + - name: Install Rust toolchain + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal --target x86_64-unknown-linux-musl --component llvm-tools-preview + rustup default "${{ needs.rust-version.outputs.version }}" - name: Format, check, and test examples run: ./scripts/test.py --operation validate validate-windows: name: validate sources (windows) + needs: rust-version runs-on: windows-2025 - permissions: - contents: read steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - uses: roc-lang/setup-roc@cbe782d6f165b89c87d99f50a59ac4f5f73b4427 # ratchet:roc-lang/setup-roc@v0.3.0 with: version: nightly-new-compiler - - uses: dtolnay/rust-toolchain@1.83.0 - with: - targets: x86_64-pc-windows-msvc + - name: Install Rust toolchain + shell: bash + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal --target x86_64-pc-windows-msvc + rustup default "${{ needs.rust-version.outputs.version }}" - name: Format, check, and test examples shell: bash run: ./scripts/test.py --operation validate build-examples: name: build examples (${{ matrix.target }}) - needs: validate + needs: [rust-version, validate] permissions: contents: read strategy: @@ -56,23 +71,23 @@ jobs: matrix: include: - target: x64mac - os: macos-15 + os: macos-26-intel rust_target: x86_64-apple-darwin - target: arm64mac - os: macos-15 + os: macos-26 rust_target: aarch64-apple-darwin - target: x64musl - os: ubuntu-22.04 + os: ubuntu-24.04 rust_target: x86_64-unknown-linux-musl - target: arm64musl - os: ubuntu-22.04 + os: ubuntu-24.04-arm rust_target: aarch64-unknown-linux-musl - target: x64win os: windows-2025 rust_target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Install Zig if: runner.os != 'Windows' uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5 @@ -81,9 +96,11 @@ jobs: - uses: roc-lang/setup-roc@cbe782d6f165b89c87d99f50a59ac4f5f73b4427 # ratchet:roc-lang/setup-roc@v0.3.0 with: version: nightly-new-compiler - - uses: dtolnay/rust-toolchain@1.83.0 - with: - targets: ${{ matrix.rust_target }} + - name: Install Rust toolchain + shell: bash + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal --target ${{ matrix.rust_target }} + rustup default "${{ needs.rust-version.outputs.version }}" - name: Install LLVM tools for Linux host stripping if: endsWith(matrix.target, 'musl') run: rustup component add llvm-tools-preview @@ -91,7 +108,7 @@ jobs: shell: bash run: ./scripts/test.py --operation build --target "${{ matrix.target }}" --artifact-dir dist/example-binaries - name: Upload example binaries - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: basic-cli-example-binaries-${{ matrix.target }} path: dist/example-binaries/${{ matrix.target }} @@ -99,27 +116,31 @@ jobs: run-examples: name: run examples (${{ matrix.target }}) - needs: build-examples - permissions: - contents: read + needs: [rust-version, build-examples] strategy: fail-fast: false matrix: include: - target: x64mac - os: macos-15-intel + os: macos-26-intel - target: arm64mac - os: macos-15 + os: macos-26 - target: x64musl - os: ubuntu-22.04 + os: ubuntu-24.04 + - target: arm64musl + os: ubuntu-24.04-arm - target: x64win os: windows-2025 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.83.0 + - uses: actions/checkout@v7 + - name: Install Rust toolchain + shell: bash + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal + rustup default "${{ needs.rust-version.outputs.version }}" - name: Download native example binaries - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: basic-cli-example-binaries-${{ matrix.target }} path: dist/example-binaries/${{ matrix.target }} diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 498f1565..36bb2140 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -15,8 +15,8 @@ concurrency: group: pages cancel-in-progress: true -permissions: - contents: read +# Do not add permissions here! Configure them at the job level! +permissions: {} jobs: deploy: @@ -26,16 +26,15 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} permissions: - contents: read pages: write id-token: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Setup Pages - uses: actions/configure-pages@v5 + uses: actions/configure-pages@v6 - name: Install Roc uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b @@ -61,10 +60,10 @@ jobs: -exec sed -i 's|/packages/basic-cli/|/basic-cli/|g' {} + - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v5 with: path: temp_docs - name: Deploy Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51a91cbf..35db9a8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,33 +9,47 @@ on: type: string pull_request: -permissions: - contents: read +# Do not add permissions here! Configure them at the job level! +permissions: {} concurrency: group: ${{ github.event_name == 'workflow_dispatch' && format('release-{0}', github.repository) || format('release-validate-{0}-{1}', github.repository, github.ref) }} cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }} jobs: + rust-version: + name: read Rust version + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.read.outputs.version }} + steps: + - uses: actions/checkout@v7 + - id: read + run: | + version=$(sed -n 's/^channel = "\(.*\)".*/\1/p' rust-toolchain.toml) + echo "version=$version" >> "$GITHUB_OUTPUT" + build-windows-host: name: Build Windows x64 host + needs: rust-version runs-on: windows-2025 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Rust - uses: dtolnay/rust-toolchain@1.83.0 - with: - targets: x86_64-pc-windows-msvc + shell: bash + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal --target x86_64-pc-windows-msvc + rustup default "${{ needs.rust-version.outputs.version }}" - name: Build Windows host shell: pwsh run: python scripts/build.py - name: Upload Windows host - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: windows-x64-host path: platform/targets/x64win/*.lib @@ -44,7 +58,7 @@ jobs: build: name: Build release bundle - needs: build-windows-host + needs: [rust-version, build-windows-host] # macOS cross-compiles the Apple and Linux musl hosts. Windows is built # natively above because the Rust dependencies require the Windows SDK. runs-on: macos-15 @@ -55,7 +69,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 @@ -70,13 +84,14 @@ jobs: version: 0.16.0 - name: Install Rust with cross-compilation targets - uses: dtolnay/rust-toolchain@1.83.0 - with: - components: llvm-tools-preview - targets: x86_64-apple-darwin,aarch64-apple-darwin,x86_64-unknown-linux-musl,aarch64-unknown-linux-musl + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal --component llvm-tools-preview \ + --target x86_64-apple-darwin --target aarch64-apple-darwin \ + --target x86_64-unknown-linux-musl --target aarch64-unknown-linux-musl + rustup default "${{ needs.rust-version.outputs.version }}" - name: Download Windows host - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: windows-x64-host path: platform/targets/x64win @@ -138,7 +153,7 @@ jobs: test_os_json: '["macos-15","macos-15-intel","ubuntu-22.04","windows-2025"]' - name: Upload release bundles - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: release-bundles path: .release/bundles/* @@ -146,7 +161,7 @@ jobs: retention-days: 7 - name: Upload release metadata - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: release-metadata path: | @@ -159,7 +174,7 @@ jobs: test-bundles: name: Test ${{ matrix.bundle_name }} bundle (${{ matrix.os }}) - needs: build + needs: [rust-version, build] runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -168,7 +183,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Roc uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b @@ -176,10 +191,13 @@ jobs: version: nightly-new-compiler - name: Install Rust - uses: dtolnay/rust-toolchain@1.83.0 + shell: bash + run: | + rustup toolchain install "${{ needs.rust-version.outputs.version }}" --profile minimal + rustup default "${{ needs.rust-version.outputs.version }}" - name: Download release bundles - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: release-bundles path: .release/test-bundles @@ -209,7 +227,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Roc uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b @@ -245,7 +263,7 @@ jobs: run: tar -czf docs.tar.gz -C docs-site "$DOCS_VERSION" - name: Upload docs archive - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: platform-docs path: docs.tar.gz @@ -265,24 +283,24 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Download release bundles - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: release-bundles path: .release/bundles - name: Download release metadata - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: release-metadata path: .release - name: Download docs archive - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: platform-docs @@ -318,7 +336,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Roc uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b @@ -326,7 +344,7 @@ jobs: version: nightly-new-compiler - name: Download release metadata - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: release-metadata path: .release @@ -426,13 +444,13 @@ jobs: -exec sed -i 's|/packages/basic-cli/|/basic-cli/|g' {} + - name: Setup Pages - uses: actions/configure-pages@v5 + uses: actions/configure-pages@v6 - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v5 with: path: temp_docs - name: Deploy Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/examples/command.roc b/examples/command.roc index 48cd39b2..1b7982cf 100644 --- a/examples/command.roc +++ b/examples/command.roc @@ -1,4 +1,4 @@ -## Run child processes, capture their output, and configure their environment. +## Run commands, capture their output, and set their env vars. app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.21.0-rc4/FvCh4vdqm3nBY6DWEfZ8RuGCVfjuMY43HA8KSNk9qVDn.tar.zst" } import pf.OsStr