dns resolve duration #45
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: build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - v[0-9]+.[0-9]+.x | |
| tags: | |
| - v* | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.target }} | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| runner: macos-13 | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| - target: x86_64-unknown-linux-musl | |
| runner: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| - target: aarch64-unknown-linux-musl | |
| runner: ubuntu-latest | |
| - target: x86_64-pc-windows-msvc | |
| runner: windows-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| !./target/*/*/*.zip | |
| !./target/*/*/*.tar.gz | |
| key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Update Rust Toolchain | |
| run: | | |
| rustup update stable | |
| rustup component add rustfmt rust-src clippy | |
| rustup target add ${{ matrix.target }} | |
| - name: Run Tests | |
| run: cargo test | |
| - name: Clippy Check | |
| run: cargo clippy --all-targets | |
| - name: Format Check | |
| run: cargo fmt --check | |
| - name: Build Release (linux) | |
| if: contains(matrix.target, 'linux') | |
| run: | | |
| cargo install cross --force | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Build Release (darwin or windows) | |
| if: ${{ !contains(matrix.target, 'linux') }} | |
| run: cargo build --release --target ${{ matrix.target }} | |
| # - name: Code Sign (darwin) | |
| # if: contains(matrix.target, 'darwin') | |
| # env: | |
| # APPLE_CODESIGN_KEY: '${{ secrets.APPLE_CODESIGN_KEY }}' | |
| # APPLE_CODESIGN_PASSWORD: '${{ secrets.APPLE_CODESIGN_PASSWORD }}' | |
| # echo Key is $(echo $APPLE_CODESIGN_KEY | base64 -d | wc -c) bytes | |
| # rcodesign sign target/release/basjoofan --code-signature-flags=runtime --p12-password=$APPLE_CODESIGN_PASSWORD --p12-file=<(echo $APPLE_CODESIGN_KEY | base64 -d) --entitlements-xml-file=cli/entitlements.plist | |
| - name: Compress Archive (darwin or linux) | |
| if: contains(matrix.target, 'darwin') || contains(matrix.target, 'linux') | |
| run: zip -rj target/${{ matrix.target }}/release/basjoofan-${{ matrix.target }}.zip target/${{ matrix.target }}/release/basjoofan | |
| - name: Compress Archive (windows) | |
| if: contains(matrix.target, 'windows') | |
| run: Compress-Archive -CompressionLevel Optimal -Force -Path target/${{ matrix.target }}/release/basjoofan.exe -DestinationPath target/${{ matrix.target }}/release/basjoofan-${{ matrix.target }}.zip | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: basjoofan-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/basjoofan${{ contains(matrix.target, 'windows') && '.exe' || '' }} | |
| - name: Release Version | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: target/${{ matrix.target }}/release/basjoofan-${{ matrix.target }}.zip | |
| draft: true |