From 41893ae91865e62bf1314f1ced8f9cb597fabdcd Mon Sep 17 00:00:00 2001 From: Wei Zhang Date: Fri, 16 Feb 2024 14:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A4=EF=B8=8F=20=E2=9C=A8:=20add=20loon?= =?UTF-8?q?garch=20ci=20and=20releases=20(#990)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Wei Zhang --- .github/workflows/CICD.yml | 44 ++++++++++++++++++++++++++++++++++++++ src/meta/filetype.rs | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index f2b4aeddd..d2271eb8e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -279,6 +279,50 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + container_build: + name: Container Build + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest, target: loongarch64-unknown-linux-gnu, platform: loong64 } + steps: + - uses: actions/checkout@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:master + - name: Containerized Build + # containerized build is slow, but easy to setup and cross compile + # currently only used for: + # - loongarch64 + # + # tests should be done previously + shell: bash + run: | + docker run --platform linux/${{ matrix.job.platform }} \ + -v `pwd`:/src \ + kweizh/loongarch-rust:v0.1.0 \ + build --release --target ${{ matrix.job.target }} + + # determine EXE suffix + EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac; + echo "EXE_suffix=${EXE_suffix}" >> $GITHUB_OUTPUT + - name: Archive executable artifacts + uses: actions/upload-artifact@master + with: + name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }} + path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }} + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + coverage: name: Code Coverage runs-on: ${{ matrix.job.os }} diff --git a/src/meta/filetype.rs b/src/meta/filetype.rs index 173331d82..07ca8ab2f 100644 --- a/src/meta/filetype.rs +++ b/src/meta/filetype.rs @@ -16,7 +16,7 @@ pub enum FileType { impl FileType { #[cfg(windows)] - const EXECUTABLE_EXTENSIONS: &[&'static str] = &["exe", "msi", "bat", "ps1"]; + const EXECUTABLE_EXTENSIONS: &'static [&'static str] = &["exe", "msi", "bat", "ps1"]; #[cfg(unix)] pub fn new(