11name : floki-ci
22on :
33 push :
4- tags :
5- # Full version
6- - " [0-9]+.[0-9]+.[0-9]+"
7- # Prerelease version
8- - " [0-9]+.[0-9]+.[0-9]+-*"
4+ branches :
5+ - main
96
107 pull_request :
118 branches :
@@ -23,172 +20,83 @@ jobs:
2320 uses : dtolnay/rust-toolchain@master
2421 with :
2522 toolchain : stable
23+ - name : Rust Cache
24+ 2625 - name : Run cargo clippy to pick up any errors
2726 run : cargo clippy --all-targets -- -Dwarnings
2827 - name : Check code is formatted
2928 run : cargo fmt -- --check
3029
3130 build :
32- name : Build static binary for publishing
33- runs-on : ${{ matrix.os }}
34- continue-on-error : ${{ matrix.experimental }}
31+ name : Build ${{ matrix.name }}
3532 strategy :
3633 matrix :
37- os :
38- - ubuntu-24.04
39- - macos-latest
40- rust :
41- - stable
42- - beta
43- experimental : [false]
4434 include :
45- - os : ubuntu-24.04
35+ - name : linux-stable
36+ os : ubuntu-24.04
37+ rust : stable
38+ artifact_glob : floki-*.tar.gz
39+ artifact_name : dist-linux
40+ upload_artifact : true
41+ rpm : true
42+ allow_failure : false
43+ - name : linux-beta
44+ os : ubuntu-24.04
45+ rust : beta
46+ artifact_glob : floki-*.tar.gz
47+ artifact_name : linux-beta
48+ upload_artifact : false
49+ rpm : false
50+ allow_failure : false
51+ - name : linux-nightly
52+ os : ubuntu-24.04
4653 rust : nightly
47- experimental : true
48- steps :
49- - uses : actions/checkout@v5
50- - name : Install rust
51- uses : dtolnay/rust-toolchain@master
52- with :
53- toolchain : ${{ matrix.rust }}
54- - name : Install cargo-get
55- run : cargo install cargo-get
56- - name : Run tests
57- run : cargo test --all-features
58- - run : " ./build.sh"
59- env :
60- OS_NAME : ${{ matrix.os }}
61- - name : Archive artifacts
62- uses : actions/upload-artifact@v5
63- if : ${{ matrix.rust == 'stable' }}
64- with :
65- name : stableartifacts-${{ matrix.os }}
66- path : |
67- floki*.zip
68- floki*.tar.gz
54+ artifact_glob : floki-*.tar.gz
55+ artifact_name : linux-nightly
56+ upload_artifact : false
57+ rpm : false
58+ allow_failure : true
59+ - name : macos-stable
60+ os : macos-latest
61+ rust : stable
62+ artifact_glob : floki-*.zip
63+ artifact_name : dist-macos
64+ upload_artifact : true
65+ rpm : false
66+ allow_failure : false
67+ - name : macos-beta
68+ os : macos-latest
69+ rust : beta
70+ artifact_glob : floki-*.zip
71+ artifact_name : macos-beta
72+ upload_artifact : false
73+ rpm : false
74+ allow_failure : false
75+ uses : ./.github/workflows/build-artifacts.yml
76+ with :
77+ runner : ${{ matrix.os }}
78+ toolchain : ${{ matrix.rust }}
79+ artifact_glob : ${{ matrix.artifact_glob }}
80+ artifact_name : ${{ matrix.artifact_name }}
81+ upload_artifact : ${{ matrix.upload_artifact }}
82+ run_tests : true
83+ rpm : ${{ matrix.rpm }}
84+ allow_failure : ${{ matrix.allow_failure }}
85+ fetch_depth : ' 1'
6986
70-
7187 rpm :
72- name : Build and test RPM using cargo generate-rpm
88+ name : Verify RPM installation
7389 runs-on : ubuntu-24.04
7490 needs : build
7591 steps :
76- - uses : actions/checkout@v5
77- - name : Install rust
78- uses : dtolnay/rust-toolchain@master
79- with :
80- toolchain : stable
81- - name : Install cargo-generate-rpm
82- run : cargo install cargo-generate-rpm
83- # Download the ubuntu artifact instead of rebuilding.
84- - name : Download artifacts
92+ - name : Download linux artifacts
8593 uses : actions/download-artifact@v6
8694 with :
87- name : stableartifacts-ubuntu-24.04
88- - name : Build RPM
89- run : |
90- tar -xzvf floki*.tar.gz
91- mkdir -p target/release
92- cp floki target/release/floki
93- cargo generate-rpm
94- - name : Debug
95- run : |
96- set -ex
97-
98- ls -ltR .
99- ls -l /usr/bin
100-
95+ name : dist-linux
96+ path : dist-linux
10197 - name : Install RPM
102- run : find . -name "floki*.rpm" | xargs sudo rpm -ivh
98+ run : |
99+ set -euxo pipefail
100+ find dist-linux -name "floki*.rpm" -exec sudo rpm -ivh {} \;
103101 - name : Test installation
104102 run : floki -V
105- - name : Archive artifacts
106- uses : actions/upload-artifact@v5
107- with :
108- name : rpm
109- path : |
110- target/generate-rpm/floki*.rpm
111-
112- publish :
113- name : Publish release artifact
114- runs-on : ubuntu-latest
115- if : github.ref_type == 'tag'
116- needs :
117- - build
118- - rpm
119- # Required to publish a release
120- permissions :
121- contents : write
122- steps :
123- - uses : actions/checkout@v5
124- - name : Install rust
125- uses : dtolnay/rust-toolchain@master
126- with :
127- toolchain : stable
128- - name : Install cargo-get
129- run : cargo install cargo-get
130- - name : Publish to crates.io
131- run : cargo publish
132- env :
133- CARGO_REGISTRY_TOKEN : ${{ secrets.PUBLISH_SECRET }}
134- # After publishing, create a release
135- - name : Download ubuntu artifacts
136- uses : actions/download-artifact@v6
137- with :
138- name : stableartifacts-ubuntu-24.04
139- - name : Download macos artifacts
140- uses : actions/download-artifact@v6
141- with :
142- name : stableartifacts-macos-latest
143- - name : Download RPM
144- uses : actions/download-artifact@v6
145- with :
146- name : rpm
147- - name : Generate release.txt
148- run : " ./changelog.sh"
149- - name : Release
150- uses : softprops/action-gh-release@v2
151- with :
152- body_path : release.txt
153- files : |
154- floki*.zip
155- floki*.tar.gz
156- floki*.rpm
157- # # Announce the release
158- # - run: "./announce.sh"
159- # env:
160- # ANNOUNCE_HOOK: ${{ secrets.ANNOUNCE_HOOK }}
161-
162- publish-dry-run :
163- name : Dry-run publish for non-release artifact
164- runs-on : ubuntu-latest
165- if : github.ref_type != 'tag'
166- needs :
167- - build
168- - rpm
169- steps :
170- - uses : actions/checkout@v5
171- - name : Install rust
172- uses : dtolnay/rust-toolchain@master
173- with :
174- toolchain : stable
175- - name : Install cargo-get
176- run : cargo install cargo-get
177- - name : Dry-run publish on non-tags
178- run : cargo publish --dry-run
179- # Test downloading the artifacts
180- - name : Download ubuntu artifacts
181- uses : actions/download-artifact@v6
182- with :
183- name : stableartifacts-ubuntu-24.04
184- - name : Download macos artifacts
185- uses : actions/download-artifact@v6
186- with :
187- name : stableartifacts-macos-latest
188- - name : Download rpm
189- uses : actions/download-artifact@v6
190- with :
191- name : rpm
192- # Test generating release.txt
193- - name : Generate release.txt
194- run : " ./changelog.sh"
0 commit comments