1- name : " Build Packages "
1+ name : " Indy-Credx "
22
3- " on " :
3+ env :
4+ RUST_VERSION : " 1.60.0"
5+ CROSS_VERSION : " 0.2.4"
6+ OPENSSL_STATIC : 1
7+
8+ on :
9+ push :
10+ branches : [main]
11+ pull_request :
12+ branches : [main]
413 release :
514 types : [created]
615 workflow_dispatch :
716 inputs :
8- publish :
9- description : " Publish packages"
17+ publish-binaries :
18+ description : " Publish Binaries to Release (will create a release if no release exists for branch or tag)"
19+ required : true
20+ default : false
21+ type : boolean
22+ publish-wrappers :
23+ description : " Publish Wrappers to Registries"
1024 required : true
11- default : " false"
25+ default : false
26+ type : boolean
1227
1328jobs :
14- build-manylinux :
15- name : Build Library (Manylinux)
16-
29+ checks :
30+ name : Run checks
1731 strategy :
32+ fail-fast : false
1833 matrix :
19- include :
20- - os : ubuntu-latest
21- lib : libindy_credx.so
22- container : andrewwhitehead/manylinux2014-base
23-
24- container : ${{ matrix.container }}
34+ os : [ubuntu-latest, macos-latest, windows-latest]
2535 runs-on : ${{ matrix.os }}
2636
2737 steps :
2838 - name : Checkout
29- uses : actions/checkout@v2
39+ uses : actions/checkout@v3
3040
3141 - name : Install Rust toolchain
32- uses : actions-rs/ toolchain@v1
42+ uses : dtolnay/rust- toolchain@master
3343 with :
34- profile : minimal
35- toolchain : stable
44+ toolchain : ${{ env.RUST_VERSION }}
45+ components : clippy, rustfmt
3646
3747 - name : Cache cargo resources
38- uses : Swatinem/rust-cache@v1
48+ uses : Swatinem/rust-cache@v2
49+ with :
50+ shared-key : deps
51+ cache-on-failure : true
3952
40- - name : Build library
41- env :
42- BUILD_FEATURES : vendored
43- BUILD_TARGET : ${{ matrix.target }}
44- run : sh ./build.sh
53+ - name : Cargo fmt
54+ run : cargo fmt --all -- --check
55+
56+ - name : Cargo check
57+ run : cargo check --workspace --features vendored
58+
59+ - if : " runner.os == 'Linux'"
60+ name : Pre-install cross
61+ run : |
62+ cargo install --bins --git https://github.com/rust-embedded/cross --tag v${{ env.CROSS_VERSION }} cross
63+
64+ tests :
65+ name : Run tests
66+ needs : [checks]
67+ strategy :
68+ fail-fast : false
69+ matrix :
70+ os : [ubuntu-latest, macos-latest, windows-latest]
71+ runs-on : ${{ matrix.os }}
72+
73+ steps :
74+ - name : Checkout
75+ uses : actions/checkout@v3
76+
77+ - name : Install Rust toolchain
78+ uses : dtolnay/rust-toolchain@master
79+ with :
80+ toolchain : ${{ env.RUST_VERSION }}
4581
46- - name : Upload library artifacts
47- uses : actions/upload-artifact @v2
82+ - name : Cache cargo resources
83+ uses : Swatinem/rust-cache @v2
4884 with :
49- name : library-${{ runner.os }}
50- path : target/release/${{ matrix.lib }}
85+ shared-key : deps
86+ save-if : false
87+
88+ - name : Debug build
89+ run : cargo build --all-targets --features vendored
90+
91+ - name : Test indy-utils
92+ run : cargo test --manifest-path indy-utils/Cargo.toml
93+
94+ # - name: Test indy-data-types (CL)
95+ # run: cargo test --manifest-path indy-data-types/Cargo.toml --features cl
96+
97+ - name : Test indy-data-types (CL-native)
98+ run : cargo test --manifest-path indy-data-types/Cargo.toml --features cl_native,vendored
5199
52- build-other :
53- name : Build Library (MacOS/Win)
100+ - name : Test indy-credx (vendored)
101+ run : cargo test --manifest-path indy-credx/Cargo.toml --features vendored
102+
103+ build-release :
104+ name : Build library
105+ needs : [checks]
54106
55107 strategy :
56108 matrix :
57109 include :
58- - os : macos-11
110+ - architecture : linux-aarch64
111+ os : ubuntu-latest
112+ lib : libindy_credx.so
113+ target : aarch64-unknown-linux-gnu
114+ use_cross : true
115+ - architecture : linux-x86_64
116+ os : ubuntu-latest
117+ lib : libindy_credx.so
118+ target : x86_64-unknown-linux-gnu
119+ use_cross : true
120+ - architecture : darwin-universal
121+ os : macos-latest
59122 lib : libindy_credx.dylib
60- target : apple-darwin
61- toolchain : beta # beta required for Darwin build
62- - os : windows-latest
123+ target : darwin-universal
124+ # beta or nightly required for aarch64-apple-darwin target
125+ toolchain : beta
126+ - architecture : windows-x86_64
127+ os : windows-latest
63128 lib : indy_credx.dll
64- toolchain : stable
129+ target : x86_64-pc-windows-msvc
65130
66131 runs-on : ${{ matrix.os }}
67-
68132 steps :
69133 - name : Checkout
70- uses : actions/checkout@v2
134+ uses : actions/checkout@v3
71135
72136 - name : Install Rust toolchain
73- uses : actions-rs/ toolchain@v1
137+ uses : dtolnay/rust- toolchain@master
74138 with :
75- profile : minimal
76- toolchain : ${{ matrix.toolchain }}
139+ toolchain : ${{ matrix.toolchain || env.RUST_VERSION }}
77140
78141 - name : Cache cargo resources
79- uses : Swatinem/rust-cache@v1
142+ uses : Swatinem/rust-cache@v2
143+ with :
144+ shared-key : deps
145+ save-if : false
146+
147+ - if : ${{ matrix.use_cross }}
148+ name : Build (cross)
149+ run : |
150+ cargo install --bins --git https://github.com/rust-embedded/cross --tag v${{ env.CROSS_VERSION }} cross
151+ cross build --lib --release --package indy-credx --target ${{ matrix.target }} --features vendored
152+
153+ - if : ${{ !matrix.use_cross && matrix.architecture == 'darwin-universal' }}
154+ name : Build (mac)
155+ run : BUILD_FEATURES=vendored ./build-universal.sh
80156
81- # pre-build so that openssl dependency is cached , otherwise it will complain:
157+ # Requires using the default shell on Windows , otherwise it will complain:
82158 # "This perl implementation doesn't produce Windows like paths"
83- - if : " runner.os == 'Windows'"
84- name : Pre-build (Windows)
85- uses : actions-rs/cargo@v1
86- env :
87- OPENSSL_STATIC : 1
159+ - if : ${{ !matrix.use_cross && matrix.architecture != 'darwin-universal' }}
160+ name : Build (standard)
161+ run : |
162+ cargo build --lib --release --package indy-credx --target ${{ matrix.target }} --features vendored
163+
164+ - name : Upload artifacts
165+ uses : actions/upload-artifact@v3
88166 with :
89- command : build
90- args : --release --manifest-path indy-credx/Cargo.toml --features vendored
167+ name : library-${{ matrix.architecture }}
168+ path : target/${{ matrix.target }}/release/${{ matrix.lib }}
91169
92- - name : Build library
93- env :
94- BUILD_FEATURES : vendored
95- BUILD_TARGET : ${{ matrix.target }}
96- BUILD_TOOLCHAIN : ${{ matrix.toolchain }}
97- OPENSSL_STATIC : 1
98- run : sh ./build.sh
99-
100- - name : Upload library artifacts
101- uses : actions/upload-artifact@v2
170+ - name : Create artifacts directory
171+ if : |
172+ github.event_name == 'release' ||
173+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
174+ run : |
175+ mkdir release-artifacts
176+ cp target/${{ matrix.target }}/release/${{ matrix.lib }} release-artifacts/
177+
178+ 179+ if : |
180+ github.event_name == 'release' ||
181+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
182+ with :
183+ command : c
184+ cwd : release-artifacts
185+ files : .
186+ outPath : " library-${{ matrix.architecture }}.tar.gz"
187+
188+ - name : Add artifacts to release
189+ if : |
190+ github.event_name == 'release' ||
191+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
192+ uses : svenstaro/upload-release-action@v2
102193 with :
103- name : library-${{ runner.os }}
104- path : target/release/ ${{ matrix.lib }}
194+ file : library-${{ matrix.architecture }}.tar.gz
195+ asset_name : " library- ${{ matrix.architecture }}.tar.gz "
105196
106197 build-py :
107- name : Build Python
108- needs : [build-manylinux, build-other ]
198+ name : Build and test Python wrapper
199+ needs : [build-release ]
109200
110201 strategy :
111202 matrix :
112- os : [ubuntu-latest, macos-11, windows-latest]
113- python-version : [3.6]
203+ architecture :
204+ [linux-aarch64, linux-x86_64, darwin-universal, windows-x86_64]
205+ python-version : ["3.8"]
114206 include :
115207 - os : ubuntu-latest
208+ architecture : linux-aarch64
209+ plat-name : manylinux2014_aarch64
210+ - os : ubuntu-latest
211+ architecture : linux-x86_64
116212 plat-name : manylinux2014_x86_64
117- - os : macos-11
213+ - os : macos-latest
214+ architecture : darwin-universal
118215 plat-name : macosx_10_9_universal2 # macosx_10_9_x86_64
119216 - os : windows-latest
217+ architecture : windows-x86_64
120218 plat-name : win_amd64
121219
122220 runs-on : ${{ matrix.os }}
123221
124222 steps :
125223 - name : Checkout
126- uses : actions/checkout@v2
224+ uses : actions/checkout@v3
127225
128226 - name : Set up Python ${{ matrix.python-version }}
129- uses : actions/setup-python@v2
227+ uses : actions/setup-python@v4
130228 with :
131229 python-version : ${{ matrix.python-version }}
132230
@@ -136,41 +234,41 @@ jobs:
136234 pip install setuptools wheel twine auditwheel
137235
138236 - name : Fetch library artifacts
139- uses : actions/download-artifact@v2
237+ uses : actions/download-artifact@v3
140238 with :
141- name : library-${{ runner.os }}
239+ name : library-${{ matrix.architecture }}
142240 path : wrappers/python/indy_credx/
143241
144- - name : Build python package
242+ - name : Build wheel package
243+ shell : sh
145244 run : |
146245 python setup.py bdist_wheel --python-tag=py3 --plat-name=${{ matrix.plat-name }}
147246 working-directory : wrappers/python
148247
149- - name : Test python package
150- shell : sh
151- run : |
152- cd wrappers/python
153- pip install --upgrade pip
154- pip install dist/*
155- python -m demo.test
248+ - name : Run tests
249+ # FIXME cross platform test the python package
250+ # maybe use the cross docker image?
251+ if : " matrix.architecture != 'linux-aarch64'"
252+ run : python -m demo.test
253+ working-directory : wrappers/python
254+ env :
255+ no_proxy : " *" # python issue 30385
256+ RUST_BACKTRACE : full
257+ # RUST_LOG: debug
156258
157259 - if : " runner.os == 'Linux'"
158- name : Auditwheel
159- run : auditwheel show wrappers/python/dist/*
160-
161- - name : Upload python package
162- uses : actions/upload-artifact@v2
163- with :
164- name : python-${{ runner.os }}
165- path : wrappers/python/dist/*
260+ name : Audit wheel
261+ run : |
262+ auditwheel show wrappers/python/dist/* | tee auditwheel.log
263+ grep -q manylinux_2_17_ auditwheel.log
166264
167265 - if : |
168- (github.event_name == 'release' ||
169- (github.event_name == 'workflow_dispatch' &&
170- github.event.inputs.publish == 'true'))
171- name: Publish python package
266+ github.event_name == 'release' ||
267+ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-wrappers == 'true')
268+ name: Publish
172269 env:
173270 TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
174271 TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
175272 run: |
176- twine upload --skip-existing wrappers/python/dist/*
273+ twine upload --skip-existing dist/*
274+ working-directory: wrappers/python
0 commit comments