-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GH actions for mac and linux (#44)
* Create macosx.yml * Update macosx.yml * Create linux.yml
- Loading branch information
1 parent
9d4e7ae
commit b6e0262
Showing
2 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Linux | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
mode: [ debug, release ] | ||
rhi: [ opengl ] # Add vulkan | ||
# rhi: [ dx11, dx12, opengl, vulkan, metal ] | ||
|
||
steps: | ||
- name: Get current date as package key | ||
id: cache_key | ||
run: echo "key=$(date +'%W')" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set xmake env | ||
run: echo "XMAKE_GLOBALDIR=${{ github.workspace }}/xmake-global" >> $GITHUB_ENV | ||
|
||
# Install xmake | ||
- name: Setup xmake | ||
uses: xmake-io/github-action-setup-xmake@v1 | ||
with: | ||
xmake-version: latest | ||
actions-cache-folder: .xmake-cache-W${{ env.key }} | ||
|
||
- name: Update xmake repository | ||
run: xmake repo --update | ||
|
||
- name: Retrieve dependencies hash | ||
id: dep_hash | ||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Restore cached xmake dependencies | ||
id: restore-depcache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | ||
key: ${{ matrix.rhi }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ env.hash }}-W${{ env.key }} | ||
|
||
- name: Check xmake packages directory exists | ||
shell: bash | ||
run: | | ||
if [ -d "${{ env.XMAKE_GLOBALDIR }}/.xmake/packages" ]; then | ||
echo "Packages directory exists." | ||
ls -la "${{ env.XMAKE_GLOBALDIR }}/.xmake/packages" | ||
else | ||
echo "Packages directory does not exist." | ||
fi | ||
- name: Configure xmake and install dependencies | ||
run: xmake config --mode=${{ matrix.mode }} --ccache=n --rhi=${{ matrix.rhi }} --yes | ||
|
||
- name: Save cached xmake dependencies | ||
if: ${{ !steps.restore-depcache.outputs.cache-hit }} | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | ||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }} | ||
|
||
- name: Build Visualizer | ||
run: xmake --all --yes | ||
|
||
- name: Run compile tests | ||
run: xmake test */compile_pass | ||
|
||
- name: Run tests | ||
run: xmake test */run_5_seconds |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: MacOSX | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
mode: [ debug, release ] | ||
rhi: [ metal, opengl ] # Add vulkan support | ||
# rhi: [ dx11, dx12, opengl, vulkan ] | ||
|
||
steps: | ||
- name: Get current date as package key | ||
id: cache_key | ||
run: echo "key=$(date +'%W')" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set xmake env | ||
run: echo "XMAKE_GLOBALDIR=${{ github.workspace }}/xmake-global" >> $GITHUB_ENV | ||
|
||
# Install xmake | ||
- name: Setup xmake | ||
uses: xmake-io/github-action-setup-xmake@v1 | ||
with: | ||
xmake-version: latest | ||
actions-cache-folder: .xmake-cache-W${{ env.key }} | ||
|
||
- name: Update xmake repository | ||
run: xmake repo --update | ||
|
||
- name: Retrieve dependencies hash | ||
id: dep_hash | ||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Restore cached xmake dependencies | ||
id: restore-depcache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | ||
key: ${{ matrix.rhi }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ env.hash }}-W${{ env.key }} | ||
|
||
- name: Check xmake packages directory exists | ||
shell: bash | ||
run: | | ||
if [ -d "${{ env.XMAKE_GLOBALDIR }}/.xmake/packages" ]; then | ||
echo "Packages directory exists." | ||
ls -la "${{ env.XMAKE_GLOBALDIR }}/.xmake/packages" | ||
else | ||
echo "Packages directory does not exist." | ||
fi | ||
- name: Configure xmake and install dependencies | ||
run: xmake config --mode=${{ matrix.mode }} --ccache=n --rhi=${{ matrix.rhi }} --yes | ||
|
||
- name: Save cached xmake dependencies | ||
if: ${{ !steps.restore-depcache.outputs.cache-hit }} | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | ||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }} | ||
|
||
- name: Build Visualizer | ||
run: xmake --all --yes | ||
|
||
- name: Run compile tests | ||
run: xmake test */compile_pass | ||
|
||
- name: Run tests | ||
run: xmake test */run_5_seconds |