From 23af3f9c1dc753f8ef4b05914942d29de016a485 Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 18 Jun 2026 17:33:57 +0800 Subject: [PATCH] ci: add Gitea Actions build workflow --- .gitea/workflows/build.yml | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..5515fc7 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + branches: [main] + tags: ["*"] + pull_request: + branches: [main] + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: linux + runs-on: ubuntu-latest + target: x86_64-unknown-linux-gnu + binary: ccsm + archive: ccsm-linux-amd64.tar.gz + - os: macos + runs-on: macos-latest + target: x86_64-apple-darwin + binary: ccsm + archive: ccsm-darwin-amd64.tar.gz + - os: windows + runs-on: windows-latest + target: x86_64-pc-windows-msvc + binary: ccsm.exe + archive: ccsm-windows-amd64.zip + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: https://gitea.com/actions/rust-toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + + - name: Build + run: cargo build --release --target ${{ matrix.target }} + + - name: Package (linux / macos) + if: matrix.os != 'windows' + run: | + cd target/${{ matrix.target }}/release + tar czf ${{ matrix.archive }} ${{ matrix.binary }} + + - name: Package (windows) + if: matrix.os == 'windows' + run: | + cd target\${{ matrix.target }}\release + 7z a ${{ matrix.archive }} ${{ matrix.binary }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ccsm-${{ matrix.os }}-amd64 + path: target/${{ matrix.target }}/release/${{ matrix.archive }}