From 03b6704030254bc2d59334669d1400c1b32d897f Mon Sep 17 00:00:00 2001 From: EduardoRodriguesF Date: Sat, 5 Aug 2023 16:30:26 -0300 Subject: [PATCH] ci: build test --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0fc7b7f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: Build + +on: + push: + branches: + - build-test + +jobs: + build_archive: + name: Build archive + runs-on: ${{ matrix.os }} + permissions: + contents: write + env: + CARGO: cargo + # When CARGO is set to CROSS, this is set to `--target matrix.target`. + TARGET_FLAGS: "" + # When CARGO is set to CROSS, TARGET_DIR includes matrix.target. + TARGET_DIR: ./target + strategy: + fail-fast: false + matrix: + build: [linux-gnu, linux-gnu-aarch, linux-musl, linux-musl-aarch, macos, macos-arm] + include: + - build: linux-gnu + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - build: linux-gnu-aarch + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + + - build: linux-musl + os: ubuntu-latest + target: x86_64-unknown-linux-musl + - build: linux-musl-aarch + os: ubuntu-latest + target: aarch64-unknown-linux-musl + + - build: macos + os: macos-latest + target: x86_64-apple-darwin + - build: macos-arm + os: macos-latest + target: aarch64-apple-darwin + steps: + - uses: actions/checkout@v3 + - name: Download man page + uses: actions/download-artifact@v3 + with: + name: quartz.1 + path: doc + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + target: ${{ matrix.target }} + - name: Use Cross + shell: bash + run: | + cargo install cross + + - name: Build binary + run: cross build --verbose --release --target ${{ matrix.target }} + - name: Build archive + shell: bash + run: | + staging="quartz-${{ github.ref_name }}-${{ matrix.target }}" + mkdir -p "$staging"/doc + + cp {README.md,LICENSE} "$staging/" + cp CHANGELOG.md "$staging/doc/" + + cp doc/quartz.1 "$staging/doc/quartz.1" + + cp "target/${{ matrix.target }}/release/quartz" "$staging/" + tar czf "$staging.tar.gz" "$staging" + echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV