Skip to content

Commit cd6490f

Browse files
committed
Merge branch 'feature/ci-add-musl-support'
2 parents 6f501fd + d257060 commit cd6490f

File tree

3 files changed

+111
-23
lines changed

3 files changed

+111
-23
lines changed

.github/workflows/ci.yml

Lines changed: 90 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Rust
22

33
on:
44
push:
5-
branches: [ "release/*" ]
5+
branches: ["release/*"]
66
# pull_request:
77
# branches: [ "main" ]
88

@@ -12,25 +12,94 @@ env:
1212
# TODO add musl to CI see DEVELOPMENT.md
1313

1414
jobs:
15-
test_and_publish:
15+
test:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
19-
- name: Extra Cargo
20-
run: cargo install cargo-caw-publish
21-
- name: Run tests
22-
run: cargo test
23-
- name: Build
24-
run: cargo build -r --target x86_64-unknown-linux-gnu
25-
- name: Publish to crates.io
26-
env:
27-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
28-
run: cargo caw-publish
29-
- name: Publish to Github Releases
30-
env:
31-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
32-
# TODO https://github.com/rmoraes92/http_status_code_check/actions/runs/13607277508/job/38040223389
33-
run: |
34-
cp target/release/http_status_code_check target/release/http_status_code_check-x86_64-unknown-linux-gnu
35-
ver=$(cat Cargo.toml | grep -e '^version = ".*"$' | sed 's/version = "\(.*\)"/\1/')
36-
gh release create --title v$ver --notes-file RELEASE.md $ver target/release/http_status_code_check-x86_64-unknown-linux-gnu
18+
- name: Checkout Repo
19+
uses: actions/checkout@v4
20+
- name: Run tests
21+
run: cargo test
22+
publish_cratesio:
23+
needs: test
24+
name: Publish to crates.io
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout Repo
28+
uses: actions/checkout@v4
29+
- name: Install Extra Cargo Crates
30+
run: cargo install cargo-caw-publish
31+
- name: Publish to crates.io
32+
env:
33+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
34+
run: cargo caw-publish
35+
github_release_create:
36+
needs: test
37+
name: Github Release - Creating Release
38+
runs-on: ubuntu-latest
39+
outputs:
40+
pkg_ver: ${{ steps.capture_version_from_cargo.outputs.pkg_ver }}
41+
steps:
42+
- name: Checkout Repo
43+
uses: actions/checkout@v4
44+
45+
# TODO create a cargo crate to query data from Cargo.toml
46+
47+
- id: capture_version_from_cargo
48+
name: Capture Version from Cargo.toml
49+
run: |
50+
ver=$(cat Cargo.toml | grep -e '^version = ".*"$' | sed 's/version = "\(.*\)"/\1/')
51+
echo "pkg_ver=$ver" >> "$GITHUB_OUTPUT"
52+
53+
- name: Create Github Release
54+
env:
55+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
56+
PKG_VER: ${{ steps.capture_version_from_cargo.outputs.pkg_ver }}
57+
run: |
58+
gh release create \
59+
--title v$PKG_VER --notes-file RELEASE.md $PKG_VER
60+
github_release_upload:
61+
needs: github_release_create
62+
name: Github Release - Upload Artifacts
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
build:
67+
- linux gnu x86_64
68+
- linux musl x64
69+
include:
70+
- build: linux musl x64
71+
os: ubuntu-latest
72+
rust: stable
73+
rust_target: x86_64-unknown-linux-musl
74+
- build: linux gnu x86_64
75+
os: ubuntu-latest
76+
rust: stable
77+
rust_target: x86_64-unknown-linux-gnu
78+
steps:
79+
- name: Checkout Repo
80+
uses: actions/checkout@v4
81+
82+
- name: Install Dependencies - musl
83+
if: matrix.rust_target == 'x86_64-unknown-linux-musl'
84+
run: |
85+
sudo apt-get install -y --no-install-recommends musl-tools
86+
rustup target add x86_64-unknown-linux-musl
87+
88+
- name: Build
89+
run: cargo build -r --target ${{ matrix.rust_target }}
90+
91+
- name: Adjust Target Name
92+
run: |
93+
cp \
94+
target/${{ matrix.rust_target }}/release/http_status_code_check \
95+
target/${{ matrix.rust_target }}/release/http_status_code_check-${{ matrix.rust_target }}
96+
97+
- name: Publish to Github Releases
98+
env:
99+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
100+
# TODO resolving to blank
101+
PKG_VER: ${{ needs.github_release_create.outputs.pkg_ver }}
102+
run: |
103+
gh release upload \
104+
$PKG_VER \
105+
target/${{ matrix.rust_target }}/release/http_status_code_check-${{ matrix.rust_target }}

DEVELOPMENT.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,23 @@
44

55
then
66

7-
`cargo build -r --target=x86_64-unknown-linux-musl`
7+
`cargo build -r --target=x86_64-unknown-linux-musl`
8+
9+
CI/CD
10+
11+
sudo apt-get install -y --no-install-recommends musl-tools
12+
13+
check
14+
https://github.com/zellij-org/zellij/blob/main/.github/workflows/release.yml
15+
16+
## Watch CI process
17+
18+
gh run watch
19+
20+
## Review processed CI workflows
21+
22+
gh run view --log-failed
23+
24+
## Rerunning failed CI
25+
26+
gh run rerun --failed

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Release Notes for v0.1.1
1+
# Release Notes for v0.1.2
22

33
testing Github Release CI workflow

0 commit comments

Comments
 (0)