@@ -2,7 +2,7 @@ name: Rust
22
33on :
44 push :
5- branches : [ "release/*" ]
5+ branches : ["feature/ci-add-musl-support", "release/*"]
66 # pull_request:
77 # branches: [ "main" ]
88
1212# TODO add musl to CI see DEVELOPMENT.md
1313
1414jobs :
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 }}
0 commit comments