diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46f16ea1b..df09738f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - run: cargo test build: @@ -45,10 +44,9 @@ jobs: # Use cross to link oldest GLIBC possible. cross: true - # NOTE: MUSL may not be possible to use in the future when we'll have compiler plugins. - #- target: x86_64-unknown-linux-musl - # os: ubuntu-latest - # cross: true + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + cross: true #- target: armv7-unknown-linux-gnueabihf # os: ubuntu-latest @@ -58,6 +56,10 @@ jobs: os: ubuntu-latest cross: true + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + cross: true + - target: x86_64-apple-darwin os: macos-latest diff --git a/website/components/releaseContext.tsx b/website/components/releaseContext.tsx index 602215c4a..c919e6fd7 100644 --- a/website/components/releaseContext.tsx +++ b/website/components/releaseContext.tsx @@ -30,5 +30,5 @@ export function WithRelease({ export function ReleaseVersion() { const release = useRelease(); - return <>{release.tag}; + return <>{release.version}; } diff --git a/website/data/github.ts b/website/data/github.ts index 013c42e67..11dd09c5c 100644 --- a/website/data/github.ts +++ b/website/data/github.ts @@ -1,5 +1,6 @@ import { Octokit } from "@octokit/core"; import { components } from "@octokit/openapi-types"; +import semver from "semver"; if (typeof window !== "undefined") { throw new Error("@/data/github module is server-side only"); @@ -11,7 +12,7 @@ export type GHRelease = components["schemas"]["release"]; export type GHAsset = components["schemas"]["release-asset"]; export interface Release { - tag: string; + version: string; assets: Asset[]; } @@ -33,12 +34,24 @@ export class Releases { return new Releases(list); } - public stable(): Release | undefined { - return viewRelease(this.list.find((r) => !r.draft && !r.prerelease)); + public stable(): Release | null { + return ( + viewRelease(this.list.find((r) => !r.draft && !r.prerelease)) ?? null + ); } - public preview(): Release | undefined { - return viewRelease(this.list.find((r) => r.prerelease)); + public preview(): Release | null { + const preview = viewRelease(this.list.find((r) => r.prerelease)); + if (!preview) { + return null; + } + + const stable = this.stable(); + if (!stable || semver.lt(stable.version, preview.version)) { + return preview; + } else { + return null; + } } } @@ -47,8 +60,13 @@ function viewRelease(release: GHRelease | undefined): Release | undefined { return release; } + const version = semver.clean(release.tag_name); + if (!version) { + throw new Error(`release tag is not valid semver: '${release.tag_name}'`); + } + return { - tag: release.tag_name.replace(/^v/, ""), + version, assets: collectAssets(release), }; } diff --git a/website/package-lock.json b/website/package-lock.json index e2ba75be8..ed69732d4 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -12,6 +12,7 @@ "@types/node": "18.14.2", "@types/react": "18.0.28", "@types/react-dom": "18.0.11", + "@types/semver": "^7.5.0", "autoprefixer": "10.4.13", "eslint": "8.35.0", "eslint-config-next": "13.2.3", @@ -26,6 +27,7 @@ "prettier-plugin-tailwindcss": "0.2.8", "react": "18.2.0", "react-dom": "18.2.0", + "semver": "^7.5.1", "tailwindcss": "3.2.7", "typescript": "4.9.5" } @@ -835,6 +837,11 @@ "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==" }, + "node_modules/@types/semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==" + }, "node_modules/@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -6707,9 +6714,9 @@ } }, "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", "dependencies": { "lru-cache": "^6.0.0" }, diff --git a/website/package.json b/website/package.json index 3552a75f5..d2c1fe4da 100644 --- a/website/package.json +++ b/website/package.json @@ -17,6 +17,7 @@ "@types/node": "18.14.2", "@types/react": "18.0.28", "@types/react-dom": "18.0.11", + "@types/semver": "^7.5.0", "autoprefixer": "10.4.13", "eslint": "8.35.0", "eslint-config-next": "13.2.3", @@ -31,6 +32,7 @@ "prettier-plugin-tailwindcss": "0.2.8", "react": "18.2.0", "react-dom": "18.2.0", + "semver": "^7.5.1", "tailwindcss": "3.2.7", "typescript": "4.9.5" } diff --git a/website/pages/docs/install.mdx b/website/pages/docs/install.mdx index a4656ca05..c46188590 100644 --- a/website/pages/docs/install.mdx +++ b/website/pages/docs/install.mdx @@ -54,6 +54,23 @@ Select the tab for your computer's operating system below, then follow its insta +## Platform support + +Scarb is officially supported on the following platforms: + +- `aarch64-apple-darwin` +- `aarch64-unknown-linux-gnu` +- `x86_64-apple-darwin` +- `x86_64-pc-windows-msvc` +- `x86_64-unknown-linux-gnu` + +The builds for following platforms builds are experimental and are not supported by Scarb team. +These builds may stop being published in the future. +Use at your own risk: + +- `aarch64-unknown-linux-musl` +- `x86_64-unknown-linux-musl` + ## Scarb as a library Scarb is a [Rust](https://rust-lang.org) crate which can be used as a library in your applications.