Package as zip and upload artifacts using github action #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests and build a package | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Run tests | |
run: cargo test --verbose | |
build_release_and_package: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Build for x64 | |
run: cargo build --release --target=x86_64-pc-windows-msvc | |
- name: Build for i686 | |
run: rustup target add i686-pc-windows-msvc && cargo build --release --target=i686-pc-windows-msvc | |
- name: Package binaries | |
shell: pwsh | |
run: | | |
New-Item -Name ".\target\package\win64" -Type Directory | |
New-Item -Name ".\target\package\win32" -Type Directory | |
Copy-Item "config-release.toml" -Destination ".\target\package\win64\config.toml" | |
Copy-Item "config-release.toml" -Destination ".\target\package\win32\config.toml" | |
Copy-Item ".\target\x86_64-pc-windows-msvc\release\falcon_bms_callbacker.exe" -Destination ".\target\package\win64\" | |
Copy-Item ".\target\i686-pc-windows-msvc\release\falcon_bms_callbacker.exe" -Destination ".\target\package\win32\" | |
tree target\package /F | |
Compress-Archive -Path ".\target\package\win64\*" -DestinationPath ".\target\package\falcon_bms_callbacker-win64.zip" | |
Compress-Archive -Path ".\target\package\win32\*" -DestinationPath ".\target\package\falcon_bms_callbacker-win32.zip" | |
- name: Upload win64 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: falcon_bms_callbacker-win64.zip | |
path: ./target/package/falcon_bms_callbacker-win64.zip | |
- name: Upload win32 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: falcon_bms_callbacker-win32.zip | |
path: ./target/package/falcon_bms_callbacker-win32.zip |