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

feat: add x86_64-unknown-linux-musl build #64

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 24 additions & 2 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface ProfileData {
os: OperatingSystem;
target: string;
runTests?: boolean;
cross?: boolean;
}

const profileDataItems: ProfileData[] = [{
Expand All @@ -25,6 +26,10 @@ const profileDataItems: ProfileData[] = [{
os: OperatingSystem.Linux,
target: "x86_64-unknown-linux-gnu",
runTests: true,
}, {
os: OperatingSystem.Linux,
target: "x86_64-unknown-linux-musl",
cross: true,
}];
const profiles = profileDataItems.map((profile) => {
return {
Expand Down Expand Up @@ -56,6 +61,7 @@ const ci = {
os: profile.os,
run_tests: (profile.runTests ?? false).toString(),
target: profile.target,
cross: (profile.cross ?? false).toString(),
})),
},
},
Expand Down Expand Up @@ -93,16 +99,32 @@ const ci = {
name: "npm install",
run: "cd js/node && npm ci",
},
{
name: "Setup cross",
if: "matrix.config.cross == 'true'",
run:
"cargo install cross --git https://github.com/cross-rs/cross --rev 44011c8854cb2eaac83b173cc323220ccdff18ea",
},
{
name: "Build (Debug)",
if: "!startsWith(github.ref, 'refs/tags/')",
if: "matrix.config.cross != 'true' && !startsWith(github.ref, 'refs/tags/')",
run: "cargo build --locked --all-targets --target ${{matrix.config.target}}",
},
{
name: "Build release",
if: "startsWith(github.ref, 'refs/tags/')",
if: "matrix.config.cross != 'true' && startsWith(github.ref, 'refs/tags/')",
run: "cargo build --locked --all-targets --target ${{matrix.config.target}} --release",
},
{
name: "Build cross (Debug)",
if: "matrix.config.cross == 'true' && !startsWith(github.ref, 'refs/tags/')",
run: "cross build --locked --all-targets --target ${{matrix.config.target}}",
},
{
name: "Build cross (Release)",
if: "matrix.config.cross == 'true' && startsWith(github.ref, 'refs/tags/')",
run: "cross build --locked --all-targets --target ${{matrix.config.target}} --release",
},
{
name: "Lint",
if: "!startsWith(github.ref, 'refs/tags/') && matrix.config.target == 'x86_64-unknown-linux-gnu'",
Expand Down
37 changes: 35 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@ jobs:
- os: macOS-latest
run_tests: 'true'
target: x86_64-apple-darwin
cross: 'false'
- os: windows-latest
run_tests: 'true'
target: x86_64-pc-windows-msvc
cross: 'false'
- os: ubuntu-20.04
run_tests: 'true'
target: x86_64-unknown-linux-gnu
cross: 'false'
- os: ubuntu-20.04
run_tests: 'false'
target: x86_64-unknown-linux-musl
cross: 'true'
outputs:
ZIP_CHECKSUM_X86_64_APPLE_DARWIN: '${{steps.pre_release_x86_64_apple_darwin.outputs.ZIP_CHECKSUM}}'
ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC: '${{steps.pre_release_x86_64_pc_windows_msvc.outputs.ZIP_CHECKSUM}}'
ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU: '${{steps.pre_release_x86_64_unknown_linux_gnu.outputs.ZIP_CHECKSUM}}'
ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL: '${{steps.pre_release_x86_64_unknown_linux_musl.outputs.ZIP_CHECKSUM}}'
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
Expand All @@ -50,12 +58,21 @@ jobs:
node-version: 18
- name: npm install
run: cd js/node && npm ci
- name: Setup cross
if: matrix.config.cross == 'true'
run: 'cargo install cross --git https://github.com/cross-rs/cross --rev 44011c8854cb2eaac83b173cc323220ccdff18ea'
- name: Build (Debug)
if: '!startsWith(github.ref, ''refs/tags/'')'
if: 'matrix.config.cross != ''true'' && !startsWith(github.ref, ''refs/tags/'')'
run: 'cargo build --locked --all-targets --target ${{matrix.config.target}}'
- name: Build release
if: 'startsWith(github.ref, ''refs/tags/'')'
if: 'matrix.config.cross != ''true'' && startsWith(github.ref, ''refs/tags/'')'
run: 'cargo build --locked --all-targets --target ${{matrix.config.target}} --release'
- name: Build cross (Debug)
if: 'matrix.config.cross == ''true'' && !startsWith(github.ref, ''refs/tags/'')'
run: 'cross build --locked --all-targets --target ${{matrix.config.target}}'
- name: Build cross (Release)
if: 'matrix.config.cross == ''true'' && startsWith(github.ref, ''refs/tags/'')'
run: 'cross build --locked --all-targets --target ${{matrix.config.target}} --release'
- name: Lint
if: '!startsWith(github.ref, ''refs/tags/'') && matrix.config.target == ''x86_64-unknown-linux-gnu'''
run: cargo clippy
Expand Down Expand Up @@ -85,6 +102,13 @@ jobs:
cd target/x86_64-unknown-linux-gnu/release
zip -r dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip dprint-plugin-prettier
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip | awk '{print $1}')"
- name: Pre-release (x86_64-unknown-linux-musl)
id: pre_release_x86_64_unknown_linux_musl
if: 'matrix.config.target == ''x86_64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
run: |-
cd target/x86_64-unknown-linux-musl/release
zip -r dprint-plugin-prettier-x86_64-unknown-linux-musl.zip dprint-plugin-prettier
echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-prettier-x86_64-unknown-linux-musl.zip | awk '{print $1}')"
- name: Upload artifacts (x86_64-apple-darwin)
if: 'matrix.config.target == ''x86_64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')'
uses: actions/upload-artifact@v2
Expand All @@ -103,6 +127,12 @@ jobs:
with:
name: x86_64-unknown-linux-gnu-artifacts
path: target/x86_64-unknown-linux-gnu/release/dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip
- name: Upload artifacts (x86_64-unknown-linux-musl)
if: 'matrix.config.target == ''x86_64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')'
uses: actions/upload-artifact@v2
with:
name: x86_64-unknown-linux-musl-artifacts
path: target/x86_64-unknown-linux-musl/release/dprint-plugin-prettier-x86_64-unknown-linux-musl.zip
draft_release:
name: draft_release
if: 'startsWith(github.ref, ''refs/tags/'')'
Expand All @@ -119,11 +149,13 @@ jobs:
mv x86_64-apple-darwin-artifacts/dprint-plugin-prettier-x86_64-apple-darwin.zip .
mv x86_64-pc-windows-msvc-artifacts/dprint-plugin-prettier-x86_64-pc-windows-msvc.zip .
mv x86_64-unknown-linux-gnu-artifacts/dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip .
mv x86_64-unknown-linux-musl-artifacts/dprint-plugin-prettier-x86_64-unknown-linux-musl.zip .
- name: Output checksums
run: |-
echo "dprint-plugin-prettier-x86_64-apple-darwin.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_APPLE_DARWIN}}"
echo "dprint-plugin-prettier-x86_64-pc-windows-msvc.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_PC_WINDOWS_MSVC}}"
echo "dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_GNU}}"
echo "dprint-plugin-prettier-x86_64-unknown-linux-musl.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL}}"
- name: Create plugin file
run: deno run --allow-read=. --allow-write=. scripts/create_plugin_file.ts
- name: Get tag version
Expand All @@ -141,6 +173,7 @@ jobs:
dprint-plugin-prettier-x86_64-apple-darwin.zip
dprint-plugin-prettier-x86_64-pc-windows-msvc.zip
dprint-plugin-prettier-x86_64-unknown-linux-gnu.zip
dprint-plugin-prettier-x86_64-unknown-linux-musl.zip
plugin.json
body: |
## Install
Expand Down
Loading