Skip to content

Commit cc3d23f

Browse files
committed
test
1 parent 57b2cf5 commit cc3d23f

5 files changed

Lines changed: 340 additions & 160 deletions

File tree

.github/workflows/ci-reusable.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Reusable CI workflow
3+
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
linux:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 15
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions-rust-lang/setup-rust-toolchain@v1
14+
with:
15+
components: clippy, rustfmt
16+
rustflags: ""
17+
target: x86_64-unknown-linux-gnu
18+
- uses: mamba-org/setup-micromamba@v2
19+
env:
20+
ACTIONS_STEP_DEBUG: true
21+
- run: sudo apt-get update && sudo apt-get install -y fish zsh
22+
- run: cargo test --all-features
23+
if: always()
24+
- run: cargo fmt --check
25+
if: always()
26+
- run: cargo clippy --all-targets
27+
if: always()
28+
- run: cargo build --release --all-features
29+
if: always()
30+
31+
windows:
32+
runs-on: windows-latest
33+
timeout-minutes: 15
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
components: clippy, rustfmt
39+
rustflags: ""
40+
target: x86_64-pc-windows-msvc
41+
- uses: mamba-org/setup-micromamba@v2
42+
env:
43+
ACTIONS_STEP_DEBUG: true
44+
- run: cargo test --no-default-features --features=__test_powershell
45+
if: always()
46+
- run: cargo fmt --check
47+
if: always()
48+
- run: cargo clippy --all-targets
49+
if: always()
50+
- run: cargo build --release --features=__test_powershell
51+
if: always()

.github/workflows/ci.yml

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,5 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
linux:
11-
runs-on: ubuntu-latest
12-
timeout-minutes: 15
13-
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions-rust-lang/setup-rust-toolchain@v1
16-
with:
17-
components: clippy, rustfmt
18-
rustflags: ""
19-
target: x86_64-unknown-linux-gnu
20-
- uses: mamba-org/setup-micromamba@v2
21-
env:
22-
ACTIONS_STEP_DEBUG: true
23-
- run: sudo apt-get update && sudo apt-get install -y fish zsh
24-
- run: cargo test --all-features
25-
if: always()
26-
- run: cargo fmt --check
27-
if: always()
28-
- run: cargo clippy --all-targets
29-
if: always()
30-
- run: cargo build --release --all-features
31-
if: always()
32-
33-
windows:
34-
runs-on: windows-latest
35-
timeout-minutes: 15
36-
steps:
37-
- uses: actions/checkout@v4
38-
- uses: actions-rust-lang/setup-rust-toolchain@v1
39-
with:
40-
components: clippy, rustfmt
41-
rustflags: ""
42-
target: x86_64-pc-windows-msvc
43-
- uses: mamba-org/setup-micromamba@v2
44-
env:
45-
ACTIONS_STEP_DEBUG: true
46-
- run: cargo test --no-default-features --features=__test_powershell
47-
if: always()
48-
- run: cargo fmt --check
49-
if: always()
50-
- run: cargo clippy --all-targets
51-
if: always()
52-
- run: cargo build --release --features=__test_powershell
53-
if: always()
10+
ci:
11+
uses: ./.github/workflows/ci-reusable.yml

.github/workflows/release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
name: Release
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
#ci:
11+
# name: Run CI
12+
# uses: ./.github/workflows/ci-reusable.yml
13+
14+
release:
15+
#needs: ci
16+
runs-on: ${{ matrix.runs-on }}
17+
timeout-minutes: 15
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- runs-on: windows-latest
23+
target: x86_64-pc-windows-msvc
24+
25+
- runs-on: windows-latest
26+
target: i686-pc-windows-msvc
27+
28+
- runs-on: windows-latest
29+
target: aarch64-pc-windows-msvc
30+
31+
- runs-on: ubuntu-latest
32+
target: x86_64-unknown-linux-musl
33+
34+
- runs-on: ubuntu-latest
35+
target: i686-unknown-linux-musl
36+
37+
- runs-on: ubuntu-latest
38+
target: aarch64-unknown-linux-musl
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- uses: actions-rust-lang/setup-rust-toolchain@v1
44+
with:
45+
components: clippy, rustfmt
46+
rustflags: ""
47+
target: ${{ matrix.target }}
48+
49+
- name: Build deps (musl)
50+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y musl-tools gcc-multilib
54+
# Install aarch64 cross-compiler if needed
55+
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]]; then
56+
sudo apt-get install -y gcc-aarch64-linux-gnu
57+
fi
58+
59+
- name: Build
60+
run: cargo build --release --all-features --target=${{ matrix.target }}
61+
env:
62+
# Set linker for aarch64
63+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
64+
65+
- name: Create a zip (windows)
66+
id: create-zip
67+
if: ${{ matrix.runs-on == 'windows-latest' }}
68+
run: |
69+
mkdir release
70+
cp LICENSE release/
71+
cp target/${{ matrix.target }}/release/csm.exe release/
72+
Compress-Archive -Path release/* -DestinationPath csm-${{ github.ref_name }}-${{ matrix.target }}.zip
73+
echo "archive=csm-${{ github.ref_name }}-${{ matrix.target }}.zip" >> $GITHUB_OUTPUT
74+
75+
- name: Create a tar.gz (linux)
76+
id: create-tar
77+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
78+
run: |
79+
mkdir release
80+
cp LICENSE release/
81+
cp target/${{ matrix.target }}/release/csm release/
82+
tar -czvf csm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C release .
83+
echo "archive=csm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" >> $GITHUB_OUTPUT
84+
85+
- name: Set archive output
86+
id: archive
87+
run: echo "file=${{ steps.create-zip.outputs.archive }}${{ steps.create-tar.outputs.archive }}" >> $GITHUB_OUTPUT
88+
89+
- name: Release
90+
uses: softprops/action-gh-release@v2
91+
if: github.ref_type == 'tag'
92+
with:
93+
files: ${{ steps.archive.outputs.file }}

0 commit comments

Comments
 (0)