Skip to content
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

Publish MUSL builds #332

Merged
merged 4 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test

build:
Expand All @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion website/components/releaseContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function WithRelease({

export function ReleaseVersion() {
const release = useRelease();
return <>{release.tag}</>;
return <>{release.version}</>;
}
30 changes: 24 additions & 6 deletions website/data/github.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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[];
}

Expand All @@ -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;
}
}
}

Expand All @@ -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),
};
}
Expand Down
13 changes: 10 additions & 3 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
17 changes: 17 additions & 0 deletions website/pages/docs/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ Select the tab for your computer's operating system below, then follow its insta
</Tab>
</Tabs>

## 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.
Expand Down