-
-
Notifications
You must be signed in to change notification settings - Fork 111
refactor: kind of everything #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f61e764
c431733
e1115fd
8f1019c
898758e
8426154
9547f23
8758985
d83e2ff
f1293db
57d6da3
e555ccb
0f96914
98ce316
cd118b9
c8a3c5d
e2ebac7
c8c6f6d
fd4c969
75fae53
5ea3ff9
dab8dde
47aba25
3ac859c
0be4ce6
f7dfd5f
d28d08f
c0ae6b0
717fc6a
aa5c873
b84b9e3
4e296af
5198f6c
43b3f1a
d25c27d
305e2c3
f073cc4
c190dc1
9002718
b667a19
19e042e
92d522f
356a1d0
e7618d0
f9713bf
0213f70
237c3a7
d019847
a1b309a
1630cb5
822902b
8cd6250
3989cb3
433d748
44a05a5
0684c3e
ffca827
9b809ae
ebef0bc
b62beca
4ec6636
02fcce8
89362a9
463a074
fe8e34c
cda0d98
0f47fee
6d03e7b
1ac6f85
9ec0d53
cf2e049
eefd856
0324904
b6c993f
2ced635
0e68bfc
a0f4fc7
a6f45b9
5daa325
955c3c6
47fe970
7719c4a
3e5db6b
7fe4e17
c959f78
48ebe6f
dac801a
bbb125b
0eb60fb
d730f06
3a6eecd
6c7735f
40246bd
cf07985
7049c79
b984475
d4e08b3
df1f155
3e74532
598b009
c50a868
f7bb77d
d86a781
69b7a5e
2cdc554
9ac8672
230d4dc
af20da8
cf738cf
09ee9bb
972a633
61a0dbf
a37a68e
95b7f60
0ce45ca
ea16740
bb182a6
c356ca1
7d5b205
d6cd701
76a50cb
54065f6
92d353d
59ce701
fe58ba5
4c00270
3179257
694655a
6940051
d0e9cbe
3421205
a320fc5
97ebaed
7d87080
ffa5b95
ff676a7
b38a64c
fccd4ff
e0b81ac
4581de5
8370e4a
126709b
7d6dd2f
f15582c
ad69ed3
72c061e
b02aea8
e6f731e
45df60f
8f04bf0
f4d4035
23fe75e
7bde1cc
cb7b1c9
5719720
197cae8
0ec8069
3e2763e
4c48ced
41cb6a4
582f753
46c309f
bc173f1
563e501
c4b9778
fbd549f
7a60d79
fdc0e76
a5c3ebc
c7e8217
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [alias] | ||
| xtask = "run -p xtask --" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: "Rust toolchain (from rust-toolchain.toml)" | ||
| description: "Installs yq, reads rust-toolchain.toml, and installs that Rust toolchain via dtolnay/rust-toolchain." | ||
| inputs: | ||
| targets: | ||
| description: "Comma-separated Rust target triples to install" | ||
| required: false | ||
| default: "" | ||
| components: | ||
| description: "Comma-separated Rust components to install" | ||
| required: false | ||
| default: "" | ||
| outputs: | ||
| toolchain: | ||
| description: "Resolved toolchain channel" | ||
| value: ${{ steps.get_toolchain.outputs.toolchain }} | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Install yq (mikefarah) | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| version="v4.50.1" | ||
|
|
||
| os="${RUNNER_OS}" # Linux|macOS|Windows | ||
| arch="${RUNNER_ARCH}" # X64|ARM64 | ||
|
|
||
| case "${os}" in | ||
| Linux) platform="linux"; ext="" ;; | ||
| macOS) platform="darwin"; ext="" ;; | ||
| Windows) platform="windows"; ext=".exe" ;; | ||
| *) echo "Unsupported runner OS: ${os}" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| case "${arch}" in | ||
| X64) cpu="amd64" ;; | ||
| ARM64) cpu="arm64" ;; | ||
| *) echo "Unsupported runner arch: ${arch}" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| url="https://github.com/mikefarah/yq/releases/download/${version}/yq_${platform}_${cpu}${ext}" | ||
|
|
||
| install_dir="${RUNNER_TEMP}/yq" | ||
| mkdir -p "${install_dir}" | ||
| bin="${install_dir}/yq${ext}" | ||
|
|
||
| echo "Downloading ${url}" >&2 | ||
|
|
||
| if [[ "${os}" == "Windows" ]]; then | ||
| powershell -NoProfile -Command "Invoke-WebRequest -Uri '${url}' -OutFile '${bin}'" | ||
| else | ||
| curl -fsSL "${url}" -o "${bin}" | ||
| fi | ||
|
|
||
| if [[ "${os}" != "Windows" ]]; then | ||
| chmod +x "${bin}" | ||
| fi | ||
|
|
||
| echo "${install_dir}" >> "${GITHUB_PATH}" | ||
|
|
||
| "${bin}" --version | ||
| - name: Get toolchain from rust-toolchain.toml | ||
| id: get_toolchain | ||
| shell: bash | ||
| run: | | ||
| ext="" | ||
| if [[ "${RUNNER_OS}" == "Windows" ]]; then | ||
| ext=".exe" | ||
| fi | ||
| toolchain="$(${RUNNER_TEMP}/yq/yq${ext} -r '.toolchain.channel' rust-toolchain.toml)" | ||
| if [[ -z "${toolchain}" || "${toolchain}" == "null" ]]; then | ||
| echo "Could not determine toolchain from rust-toolchain.toml" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "toolchain=${toolchain}" >> "${GITHUB_OUTPUT}" | ||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 | ||
| with: | ||
| toolchain: ${{ steps.get_toolchain.outputs.toolchain }} | ||
| targets: ${{ inputs.targets }} | ||
| components: ${{ inputs.components }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,41 @@ | ||
| name: Build RustOwl | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| types: ["labeled"] | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| outputs: | ||
| run_id: | ||
| description: Run ID of this workflow | ||
| value: ${{ github.run_id }} | ||
|
|
||
| jobs: | ||
| rustowl: | ||
| if: github.event.action != 'labeled' || github.event.label.name == 'do-build-check' | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - ubuntu-24.04 | ||
| - ubuntu-24.04-arm | ||
| - macos-15 | ||
| - macos-13 | ||
| - windows-2022 | ||
| - windows-11-arm | ||
|
|
||
| include: | ||
| - os: ubuntu-24.04 | ||
| target: x86_64-unknown-linux-gnu | ||
| - os: ubuntu-24.04-arm | ||
| target: aarch64-unknown-linux-gnu | ||
| - os: macos-15 | ||
| target: aarch64-apple-darwin | ||
| - os: macos-15-intel | ||
| target: x86_64-apple-darwin | ||
| - os: windows-2022 | ||
| target: x86_64-pc-windows-msvc | ||
| - os: windows-11-arm | ||
| target: aarch64-pc-windows-msvc | ||
| runs-on: ${{ matrix.os }} | ||
| permissions: | ||
| contents: write | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this pinned to specific version?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security? I thought that specifying patch version results in missing security patch update...
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if you do the old syntax, one can push anything and change tag and boom! @cordx56
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then, we should use version checking bot like dependabot.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thats already done @cordx56. Its just another layer so its kind of bullet proof.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The vulnerability i mentioned, none can do nothing. Other than pinning the long hash (all big projects do this)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dependabot tracks tags, not anything else. So keeping tag same will silently pull new commits. This stops that. Dependabot will still update this (see the comment after some space? Thats the format) |
||
| with: | ||
| persist-credentials: false | ||
| # Using fat LTO causes failure to link on Windows ARM | ||
| - name: Set build profile | ||
| run: | | ||
|
|
@@ -44,56 +44,47 @@ jobs: | |
| else | ||
| echo "build_profile=release" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| # uname on Windows on ARM returns "x86_64" | ||
| - name: Set ARCH flag for Windows on ARM | ||
| if: matrix.os == 'windows-11-arm' | ||
| run: echo "TOOLCHAIN_ARCH=aarch64" >> $GITHUB_ENV | ||
|
|
||
| - name: setup env | ||
| run: | | ||
| host_tuple="$(./scripts/build/toolchain eval 'echo $HOST_TUPLE')" | ||
| echo "host_tuple=$host_tuple" >> $GITHUB_ENV | ||
| toolchain="$(./scripts/build/toolchain eval 'echo $RUSTOWL_TOOLCHAIN')" | ||
| toolchain="$(cargo xtask toolchain sh -lc 'echo $RUSTOWL_TOOLCHAIN')" | ||
| echo "toolchain=$toolchain" >> $GITHUB_ENV | ||
|
|
||
| ([[ "$host_tuple" == *msvc* ]] && echo "exec_ext=.exe" || echo "exec_ext=") >> $GITHUB_ENV | ||
| ([[ "$host_tuple" == *windows* ]] && echo "is_windows=true" || echo "is_windows=false") >> $GITHUB_ENV | ||
| ([[ "$host_tuple" == *linux* ]] && echo "is_linux=true" || echo "is_linux=false") >> $GITHUB_ENV | ||
|
|
||
| ([[ "${{ matrix.target }}" == *msvc* ]] && echo "exec_ext=.exe" || echo "exec_ext=") >> $GITHUB_ENV | ||
| ([[ "${{ matrix.target }}" == *windows* ]] && echo "is_windows=true" || echo "is_windows=false") >> $GITHUB_ENV | ||
| ([[ "${{ matrix.target }}" == *linux* ]] && echo "is_linux=true" || echo "is_linux=false") >> $GITHUB_ENV | ||
| - name: Install zig | ||
| if: ${{ env.is_linux == 'true' }} | ||
| uses: mlugg/setup-zig@v2 | ||
| uses: mlugg/setup-zig@e7d1537c378b83b8049f65dda471d87a2f7b2df2 # v2.2.0 | ||
| with: | ||
| version: 0.13.0 | ||
|
|
||
| - name: Build | ||
| run: | | ||
| if [[ "${{ env.is_linux }}" == "true" ]]; then | ||
| ./scripts/build/toolchain cargo install --locked cargo-zigbuild | ||
| ./scripts/build/toolchain cargo zigbuild --target ${{ env.host_tuple }}.2.17 --profile=${{ env.build_profile }} | ||
| cargo xtask toolchain cargo install --locked cargo-zigbuild | ||
| cargo xtask toolchain cargo zigbuild --target ${{ matrix.target }}.2.17 --profile=${{ env.build_profile }} | ||
| else | ||
| ./scripts/build/toolchain cargo build --target ${{ env.host_tuple }} --profile=${{ env.build_profile }} | ||
| cargo xtask toolchain cargo build --target ${{ matrix.target }} --profile=${{ env.build_profile }} | ||
| fi | ||
|
|
||
| - name: Check the functionality | ||
| run: | | ||
| ./target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package | ||
|
|
||
| ./target/${{ matrix.target }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package | ||
| - name: Set archive name | ||
| run: | | ||
| if [[ "${{ env.is_windows }}" == "true" ]]; then | ||
| echo "archive_name=rustowl-${{ env.host_tuple }}.zip" >> $GITHUB_ENV | ||
| echo "archive_name=rustowl-${{ matrix.target }}.zip" >> $GITHUB_ENV | ||
| else | ||
| echo "archive_name=rustowl-${{ env.host_tuple }}.tar.gz" >> $GITHUB_ENV | ||
| echo "archive_name=rustowl-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Setup archive artifacts | ||
| run: | | ||
| rm -rf rustowl && mkdir -p rustowl/sysroot/${{ env.toolchain }}/bin | ||
|
|
||
| cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} ./rustowl/ | ||
| cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin | ||
| cp target/${{ matrix.target }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} ./rustowl/ | ||
| cp target/${{ matrix.target }}/${{ env.build_profile }}/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin | ||
|
|
||
| cp README.md ./rustowl | ||
| cp LICENSE ./rustowl | ||
|
|
@@ -112,44 +103,38 @@ jobs: | |
| cd .. | ||
| fi | ||
|
|
||
| cp ./rustowl/rustowl${{ env.exec_ext }} ./rustowl-${{ env.host_tuple }}${{ env.exec_ext }} | ||
|
|
||
| cp ./rustowl/rustowl${{ env.exec_ext }} ./rustowl-${{ matrix.target }}${{ env.exec_ext }} | ||
| - name: Upload | ||
| uses: actions/upload-artifact@v6 | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | ||
| with: | ||
| name: rustowl-runtime-${{ env.host_tuple }} | ||
| name: rustowl-runtime-${{ matrix.target }} | ||
| path: | | ||
| rustowl-${{ env.host_tuple }}${{ env.exec_ext }} | ||
| rustowl-${{ matrix.target }}${{ env.exec_ext }} | ||
| ${{ env.archive_name }} | ||
|
|
||
| vscode: | ||
| if: github.event.action != 'labeled' || github.event.label.name == 'do-build-check' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Setup PNPM And Install dependencies | ||
| uses: pnpm/action-setup@v4 | ||
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | ||
| with: | ||
| package_json_file: ./vscode/package.json | ||
| run_install: | | ||
| - cwd: ./vscode | ||
|
|
||
| - name: Create VSIX | ||
| run: pnpm build | ||
| working-directory: ./vscode | ||
|
|
||
| - name: Upload | ||
| uses: actions/upload-artifact@v6 | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | ||
| with: | ||
| name: rustowl-vscode | ||
| path: vscode/**/*.vsix | ||
Uh oh!
There was an error while loading. Please reload this page.