Skip to content

Commit 1e5c3d7

Browse files
[typeshare] Support linux-arm64 and support u64 (#1)
* Switching build over to `zigbuild` to support linux arm64 variant * Porting over 1Password#140 to support large number * Adding some default overrides to include base types for stuff such as `HashSet` * Typeshare built for repo * Revert
1 parent 205dda2 commit 1e5c3d7

File tree

6 files changed

+46
-20
lines changed

6 files changed

+46
-20
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,10 @@ jobs:
8989
dist-args: --artifacts=global
9090
target: ''
9191
install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
92-
# Since we don't have a macos-11 runner, we will build manually on mac and upload
93-
# - os: macos-11
94-
# dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
95-
# target: 'aarch64-apple-darwin x86_64-apple-darwin'
96-
# install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
92+
- os: macos-11
93+
dist-args: --artifacts=local --target=aarch64-apple-darwin --target=x86_64-apple-darwin
94+
target: 'aarch64-apple-darwin x86_64-apple-darwin'
95+
install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
9796
- os: ubuntu-20.04
9897
dist-args: --artifacts=local --target=x86_64-unknown-linux-gnu
9998
target: 'x86_64-unknown-linux-gnu'
@@ -102,11 +101,10 @@ jobs:
102101
dist-args: --artifacts=local --target=aarch64-unknown-linux-gnu
103102
target: 'aarch64-unknown-linux-gnu'
104103
install-dist: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.sh | sh
105-
# We don't care for windows right now
106-
# - os: windows-2019
107-
# dist-args: --artifacts=local --target=x86_64-pc-windows-msvc
108-
# target: 'x86_64-pc-windows-msvc'
109-
# install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.ps1 | iex
104+
- os: windows-2019
105+
dist-args: --artifacts=local --target=x86_64-pc-windows-msvc
106+
target: 'x86_64-pc-windows-msvc'
107+
install-dist: irm https://github.com/axodotdev/cargo-dist/releases/download/v0.0.4/cargo-dist-v0.0.4-installer.ps1 | iex
110108

111109
runs-on: ${{ matrix.os }}
112110
env:
@@ -124,7 +122,35 @@ jobs:
124122
# The two platforms don't agree on how to talk about env vars but they
125123
# do agree on 'cat' and '$()' so we use that to marshal values between commands.
126124
run: |
127-
scripts/build.sh --target "${{ matrix.target }}" --version "${{ github.ref_name }}"
125+
pip3 install ziglang
126+
cargo install cargo-zigbuild
127+
rustup target add ${{ matrix.target }}
128+
cargo zigbuild --target ${{ matrix.target }} --release
129+
130+
# Set binary name to typeshare
131+
BINARY_NAME="typeshare"
132+
TARGET_DIR="target/${{ matrix.target }}/release"
133+
134+
# Create zip directory
135+
mkdir -p "dist"
136+
137+
# Create zip file with binary
138+
ZIP_NAME="${BINARY_NAME}-${{ github.ref_name }}-${{ matrix.target }}.zip"
139+
cd ${TARGET_DIR} && zip "../../../dist/${ZIP_NAME}" "${BINARY_NAME}${BINARY_SUFFIX}"
140+
cd ../../..
141+
142+
# Create manifest file similar to cargo-dist
143+
echo "{\"artifacts\": [{\"path\": \"dist/${ZIP_NAME}\"}]}" > dist-manifest.json
144+
145+
echo "Build complete, contents of dist-manifest.json:"
146+
cat dist-manifest.json
147+
148+
# Upload to release
149+
cat dist-manifest.json | jq --raw-output ".artifacts[]?.path | select( . != null )" > uploads.txt
150+
echo "uploading..."
151+
cat uploads.txt
152+
gh release upload ${{ github.ref_name }} $(cat uploads.txt)
153+
echo "uploaded!"
128154

129155
# Mark the Github Release™ as a non-draft now that everything has succeeded!
130156
publish-release:

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ ci = ["github"]
1313
installers = ["shell", "powershell"]
1414
# Target platforms to build apps for (Rust target-triple syntax)
1515
targets = [
16-
"aarch64-unknown-linux-gnu",
17-
"x86_64-unknown-linux-gnu",
18-
"x86_64-apple-darwin",
19-
"x86_64-pc-windows-msvc",
20-
"aarch64-apple-darwin",
16+
"aarch64-unknown-linux-gnu",
17+
"x86_64-unknown-linux-gnu",
18+
"x86_64-apple-darwin",
19+
"x86_64-pc-windows-msvc",
20+
"aarch64-apple-darwin",
2121
]
2222

2323
[profile.test]

core/src/language/kotlin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl Language for Kotlin {
9494
return Err(RustTypeFormatError::UnsupportedSpecialType(
9595
special_ty.to_string(),
9696
))
97-
}
97+
},
9898
SpecialRustType::U128 => "BigInteger".into(),
9999
})
100100
}

core/src/language/scala.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Language for Scala {
117117
return Err(RustTypeFormatError::UnsupportedSpecialType(
118118
special_ty.to_string(),
119119
))
120-
}
120+
},
121121
SpecialRustType::U128 => "BigInt".into(),
122122
})
123123
}

core/src/language/swift.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Language for Swift {
220220
return Err(RustTypeFormatError::UnsupportedSpecialType(
221221
special_ty.to_string(),
222222
))
223-
}
223+
},
224224
SpecialRustType::U128 => "UInt128".into(),
225225
})
226226
}

core/src/language/typescript.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const ReplacerFunc = (key: string, value: unknown): unknown => {{
132132
| SpecialRustType::I64
133133
| SpecialRustType::ISize
134134
| SpecialRustType::U128
135-
| SpecialRustType::USize => Ok("number".into()),
135+
| SpecialRustType::USize => Ok("number".into())
136136
}
137137
}
138138

0 commit comments

Comments
 (0)