Skip to content

Commit 802afb6

Browse files
committed
ci - adds support to musl
we introduced support to generate musl targets. we also finished implementing github release step as well.
1 parent 6f501fd commit 802afb6

File tree

3 files changed

+112
-23
lines changed

3 files changed

+112
-23
lines changed

.github/workflows/ci.yml

Lines changed: 91 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: ["feature/ci-add-musl-support", "release/*"]
66
# pull_request:
77
# branches: [ "main" ]
88

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