Skip to content

Commit a6d6931

Browse files
committed
add github action file
1 parent 8ad9f3c commit a6d6931

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
build-and-test:
10+
name: Run on ${{ matrix.os }} with SOFA ${{ matrix.sofa_branch }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-20.04, macos-10.15, windows-2019]
16+
sofa_branch: [master, v21.12]
17+
18+
steps:
19+
- name: Setup SOFA and environment
20+
id: sofa
21+
uses: sofa-framework/[email protected]
22+
with:
23+
sofa_root: ${{ github.workspace }}/sofa
24+
sofa_version: ${{ matrix.sofa_branch }}
25+
sofa_scope: 'standard'
26+
27+
- name: Checkout source code
28+
uses: actions/checkout@v2
29+
with:
30+
path: ${{ env.WORKSPACE_SRC_PATH }}
31+
32+
- name: Build and install
33+
shell: bash
34+
run: |
35+
if [[ "$RUNNER_OS" == "Windows" ]]; then
36+
cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
37+
&& cd /d $WORKSPACE_BUILD_PATH \
38+
&& cmake \
39+
-GNinja \
40+
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
41+
-DCMAKE_BUILD_TYPE=Release \
42+
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
43+
../src \
44+
&& ninja -v install"
45+
else
46+
cd "$WORKSPACE_BUILD_PATH"
47+
ccache -z
48+
cmake \
49+
-GNinja \
50+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
51+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
52+
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
53+
-DCMAKE_BUILD_TYPE=Release \
54+
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
55+
../src
56+
ninja -v install
57+
echo ${CCACHE_BASEDIR}
58+
ccache -s
59+
fi
60+
- name: Create artifact
61+
uses: actions/upload-artifact@v2
62+
with:
63+
name: ShapeMatchingPlugin_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
64+
path: ${{ env.WORKSPACE_INSTALL_PATH }}
65+
66+
- name: Install artifact
67+
uses: actions/download-artifact@v2
68+
with:
69+
name: ShapeMatchingPlugin_${{ steps.sofa.outputs.run_branch }}_for-SOFA-${{ steps.sofa.outputs.sofa_version }}_${{ runner.os }}
70+
path: ${{ env.WORKSPACE_ARTIFACT_PATH }}
71+
72+
deploy:
73+
name: Deploy artifacts
74+
if: always() && startsWith(github.ref, 'refs/heads/') # we are on a branch (not a PR)
75+
needs: [build-and-test]
76+
runs-on: ubuntu-latest
77+
continue-on-error: true
78+
steps:
79+
- name: Get artifacts
80+
uses: actions/download-artifact@v2
81+
with:
82+
path: artifacts
83+
84+
- name: Zip artifacts
85+
shell: bash
86+
run: |
87+
cd $GITHUB_WORKSPACE/artifacts
88+
for artifact in *; do
89+
zip $artifact.zip -r $artifact/*
90+
done
91+
- name: Upload release
92+
uses: softprops/action-gh-release@v1
93+
with:
94+
name: ${{ github.ref_name }}
95+
tag_name: release-${{ github.ref_name }}
96+
fail_on_unmatched_files: true
97+
files: |
98+
artifacts/ShapeMatchingPlugin_*_Linux.zip
99+
artifacts/ShapeMatchingPlugin_*_Windows.zip
100+
artifacts/ShapeMatchingPlugin_*_macOS.zip

0 commit comments

Comments
 (0)