From 0a56bd767941378cf39e5d47d0608ca9c1cf2a3c Mon Sep 17 00:00:00 2001 From: Julien Bernard Date: Fri, 13 Sep 2024 17:19:02 +0200 Subject: [PATCH] add actions --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 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..19ceb7b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + strategy: + fail-fast: false + matrix: + configurations: + - { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x64, kind: shared, mode: debug } + - { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x64, kind: shared, mode: release } + - { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x64, kind: static, mode: debug } + - { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, kind: shared, mode: debug } + - { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, kind: shared, mode: release } + - { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, kind: shared, mode: sanitizers } + - { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, kind: static, mode: debug } + + defaults: + run: + shell: ${{ matrix.configurations.shell }} + + name: ${{ matrix.configurations.name }} ${{ matrix.configurations.arch }} (${{ matrix.configurations.kind }} ${{ matrix.configurations.mode }}) + runs-on: ${{ matrix.configurations.runner }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure xmake environment + run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake" >> $GITHUB_ENV + shell: bash + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: latest + actions-cache-folder: '.xmake-cache' + actions-cache-key: ${{ matrix.configurations.name }}-${{ matrix.configurations.arch }} + + - name: Update xmake repository + run: xmake repo --update + + - name: Retrieve dependencies hash + id: deps_hash + run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT + shell: bash + + - name: Restore cached dependencies + id: restore-cache + uses: actions/cache/restore@v4 + with: + path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: ${{ matrix.configurations.plat }}-${{ matrix.configurations.arch }}-${{ matrix.configurations.kind }}-${{ matrix.configurations.mode }}-${{ steps.deps_hash.outputs.hash }} + + - name: Install dependencies + run: xmake config --plat=${{ matrix.configurations.plat }} --arch=${{ matrix.configurations.arch }} --kind=${{ matrix.configurations.kind }} --mode=${{ matrix.configurations.mode }} --yes + + - name: Save cached xmake dependencies + if: ${{ !steps.restore-cache.outputs.cache-hit }} + uses: actions/cache/save@v4 + with: + path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: ${{ steps.restore-cache.outputs.cache-primary-key }} + + - name: Build + run: xmake --yes