Unplug #812
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: Unplug | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.gitignore' | |
- '**.md' | |
- '**.txt' | |
- 'docs/**' | |
- '.vscode/**' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * *' | |
env: | |
CARGO_TERM_COLOR: always | |
stable_toolchain: 1.74.1 | |
nightly_toolchain: nightly-2024-12-20 | |
branch_name: ${{ github.base_ref || github.ref_name }} | |
jobs: | |
build: | |
name: "Build" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: windows-x64 | |
host: windows-latest | |
target: x86_64-pc-windows-msvc | |
exe-name: unplug.exe | |
- name: macos-arm64 | |
host: macos-latest | |
target: aarch64-apple-darwin | |
exe-name: unplug | |
- name: macos-x64 | |
host: macos-latest | |
target: x86_64-apple-darwin | |
exe-name: unplug | |
- name: linux-x64 | |
host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
exe-name: unplug | |
runs-on: ${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Toolchain | |
uses: ./.github/actions/toolchain | |
with: | |
target: ${{ matrix.target }} | |
stable: ${{ env.stable_toolchain }} | |
nightly: ${{ env.nightly_toolchain }} | |
- name: Fetch Crates | |
run: cargo fetch --target ${{ matrix.target }} | |
- name: Check MSRV | |
run: cargo check --workspace --all-targets --target ${{ matrix.target }} | |
- name: Build CLI | |
run: | |
cargo +${{ env.nightly_toolchain }} build | |
-v -p unplug-cli --target ${{ matrix.target }} | |
--release --no-default-features --features distribution | |
-Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort | |
env: | |
RUSTFLAGS: -C strip=symbols | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unplug-${{ env.branch_name }}-${{ matrix.name }} | |
path: target/${{ matrix.target }}/release/${{ matrix.exe-name }} | |
if-no-files-found: error | |
universal: | |
name: "macOS Universal Binary" | |
needs: build | |
runs-on: macos-latest | |
steps: | |
- name: Download ARM Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: unplug-${{ env.branch_name }}-macos-arm64 | |
path: arm64 | |
- name: Download x64 Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: unplug-${{ env.branch_name }}-macos-x64 | |
path: x64 | |
- name: Run Lipo | |
run: lipo arm64/unplug x64/unplug -create -output unplug | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unplug-${{ env.branch_name }}-macos-universal | |
path: unplug | |
if-no-files-found: error | |
- name: Delete Intermediate Artifacts | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: | | |
unplug-${{ env.branch_name }}-macos-arm64 | |
unplug-${{ env.branch_name }}-macos-x64 | |
failOnError: false | |
test: | |
name: "Test (with ISO)" | |
if: ${{ github.secret_source == 'Actions' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: windows-x64 | |
host: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-x64 | |
host: macos-latest | |
target: x86_64-apple-darwin | |
- name: linux-x64 | |
host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
runs-on: ${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Toolchain | |
uses: ./.github/actions/toolchain | |
with: | |
target: ${{ matrix.target }} | |
stable: ${{ env.stable_toolchain }} | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- if: ${{ contains(matrix.host, 'windows') }} | |
name: Download Test Resources (Windows) | |
run: | | |
Start-BitsTransfer -Source "$Env:ISO_URL" -Destination chibi.zip 2>$null | |
Start-BitsTransfer -Source "$Env:BRSAR_URL" -Destination cb_robo.brsar 2>$null | |
Expand-Archive chibi.zip -DestinationPath . | |
Remove-Item chibi.zip | |
env: | |
ISO_URL: ${{ secrets.iso_url }} | |
BRSAR_URL: ${{ secrets.brsar_url }} | |
- if: ${{ !contains(matrix.host, 'windows') }} | |
name: Download Test Resources (Unix) | |
run: | | |
curl -fsS "$ISO_URL" -o chibi.zip | |
curl -fsS "$BRSAR_URL" -o cb_robo.brsar | |
unzip chibi.zip | |
rm chibi.zip | |
env: | |
ISO_URL: ${{ secrets.iso_url }} | |
BRSAR_URL: ${{ secrets.brsar_url }} | |
- name: Build and Run Tests | |
run: cargo llvm-cov -vv --workspace --target ${{ matrix.target }} --lcov --output-path lcov.info | |
env: | |
CHIBI_ISO: ${{ github.workspace }}/chibi.iso | |
CHIBI_BRSAR: ${{ github.workspace }}/cb_robo.brsar | |
- name: Upload Code Coverage | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
flag-name: run-${{ matrix.name }} | |
path-to-lcov: lcov.info | |
parallel: true | |
test-lite: | |
name: "Test (without ISO)" | |
if: ${{ github.secret_source != 'Actions' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: windows-x64 | |
host: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-x64 | |
host: macos-latest | |
target: x86_64-apple-darwin | |
- name: linux-x64 | |
host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
runs-on: ${{ matrix.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Toolchain | |
uses: ./.github/actions/toolchain | |
with: | |
target: ${{ matrix.target }} | |
stable: ${{ env.stable_toolchain }} | |
- name: Build and Run Library Tests | |
run: cargo test -vv --workspace --target ${{ matrix.target }} --lib | |
test-done: | |
name: "Finalize Code Coverage" | |
if: github.event.pusher | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finalize Coverage | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true | |
vscode-package: | |
name: "VSCode Package" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install vsce | |
run: npm install --global @vscode/vsce | |
- name: Create VSIX | |
run: | | |
cp ../COPYING LICENSE.txt | |
vsce package --allow-missing-repository -o ../unplug-vscode.vsix | |
working-directory: unplug-vscode | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unplug-vscode | |
path: unplug-vscode.vsix |