Build on pull requests #38
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| release: | |
| types: [published] | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-bin: | |
| name: Build bin tool | |
| runs-on: ${{matrix.os}} | |
| strategy: | |
| matrix: | |
| include: | |
| - build: linux | |
| os: ubuntu-latest | |
| rust: stable | |
| target: x86_64-unknown-linux-musl | |
| cross: false | |
| bin_suffix: x86_64-linux | |
| - build: arm-v7 | |
| os: ubuntu-latest | |
| rust: stable | |
| target: armv7-unknown-linux-gnueabihf | |
| linker: gcc-arm-linux-gnueabihf | |
| cross: true | |
| bin_suffix: arm-v7-linux | |
| - build: aarch64 | |
| os: ubuntu-latest | |
| rust: stable | |
| target: aarch64-unknown-linux-gnu | |
| linker: gcc-aarch64-linux-gnu | |
| cross: true | |
| bin_suffix: aarch64-linux | |
| - build: macos | |
| os: macos-latest | |
| rust: stable | |
| target: x86_64-apple-darwin | |
| cross: false | |
| bin_suffix: macos | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 1 | |
| - name: Cache | |
| uses: actions/[email protected] | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.rustup | |
| target | |
| key: ${{ runner.os }}-${{ matrix.rust }} | |
| - name: Install Linker | |
| if: matrix.cross | |
| run: | | |
| sudo apt update | |
| sudo apt install ${{ matrix.linker }} | |
| cat .cargo/config.github >> .cargo/config | |
| - name: Install Rust | |
| run: | | |
| rustup install ${{ matrix.rust }} | |
| rustup target add ${{ matrix.target }} | |
| rustup show | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Copy and rename binary | |
| if: github.event_name == 'release' | |
| run: cp target/${{ matrix.target }}/release/esp_stacktrace_decoder esp_stacktrace_decoder_${{ matrix.bin_suffix }} | |
| - name: Upload to GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/[email protected] | |
| with: | |
| files: esp_stacktrace_decoder_${{ matrix.bin_suffix }} | |
| build-exe: | |
| name: Build exe tool | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 1 | |
| - name: Cache | |
| uses: actions/[email protected] | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.rustup | |
| target | |
| key: ${{ runner.os }}-stable | |
| - name: Install Linker | |
| run: | | |
| sudo apt update | |
| sudo apt install mingw-w64 | |
| - name: Install Rust | |
| run: | | |
| rustup install stable | |
| rustup target add x86_64-pc-windows-gnu | |
| rustup show | |
| - name: Build | |
| run: cargo build --release --target x86_64-pc-windows-gnu | |
| - name: Upload to GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/[email protected] | |
| with: | |
| files: target/x86_64-pc-windows-gnu/release/esp_stacktrace_decoder.exe | |
| build-web: | |
| name: Build web tool | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - uses: jetli/[email protected] | |
| - name: Run wasm-pack | |
| run: wasm-pack build --target web --out-dir web/ | |
| - name: Make an archive for web deployment | |
| if: github.event_name == 'release' | |
| run: tar czf esp_stacktrace_decoder_wasm.tar.gz -C web index.html esp_stacktrace_decoder_rs.js esp_stacktrace_decoder_rs_bg.wasm | |
| - name: Upload to GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/[email protected] | |
| with: | |
| files: esp_stacktrace_decoder_wasm.tar.gz | |
| - name: Copy files for GitHub Pages deployment | |
| if: github.event_name == 'release' | |
| run: mkdir -p public; cp web/index.html web/esp_stacktrace_decoder_rs.js web/esp_stacktrace_decoder_rs_bg.wasm public/ | |
| - uses: actions/[email protected] | |
| if: github.event_name == 'release' | |
| with: | |
| path: public | |
| retention-days: 1 | |
| deploy-pages: | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| contents: write | |
| if: github.event_name == 'release' | |
| needs: | |
| - build-web | |
| steps: | |
| - name: Setup Pages | |
| if: github.event_name == 'release' | |
| uses: actions/[email protected] | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name == 'release' | |
| id: deployment | |
| uses: actions/[email protected] |