Ecosystem branch check (C++) #1405
This file contains hidden or 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
name: Ecosystem branch check (C++) | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
type: string | |
required: true | |
concurrency: | |
group: ${{ inputs.branch }} | |
cancel-in-progress: true | |
jobs: | |
validate-PRs: | |
uses: Geode-solutions/Versions/.github/workflows/validate-pr.yml@master | |
with: | |
branch: ${{ inputs.branch }} | |
repos: "OpenGeode;OpenGeode-IO;OpenGeode-Geosciences;OpenGeode-GeosciencesIO;OpenGeode-Inspector;OpenGeode-Stochastic;Geode-Common_private;Geode-Numerics_private;Geode-Conversion_private;Geode-Background_private;Geode-Simplex_private;Geode-SimplexGeosciences_private;Geode-Hybrid_private;Geode-Hybrid_Geosciences_private;Geode-Viewables_private;Geode-Explicit_private;Geode-Implicit_private;Geode-FEFLOW" | |
secrets: inherit | |
linux: | |
needs: validate-PRs | |
runs-on: ubuntu-latest | |
container: ghcr.io/geode-solutions/ubuntu:master | |
outputs: | |
path: ${{ steps.repos.outputs.path }} | |
steps: | |
- uses: Geode-solutions/actions/get-release@master | |
id: repos | |
with: | |
repository: ${{ needs.validate-PRs.outputs.repos }} | |
file: "-ubuntu-private.tar.gz" | |
token: ${{ secrets.TOKEN }} | |
branch: ${{ inputs.branch }} | |
base: ${{ needs.validate-PRs.outputs.base }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux | |
path: . | |
linux-test: | |
needs: [validate-PRs, linux] | |
runs-on: ubuntu-latest | |
container: ghcr.io/geode-solutions/ubuntu:master | |
strategy: | |
matrix: | |
repo: ${{ fromJSON(needs.validate-PRs.outputs.repos_array) }} | |
fail-fast: false | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux | |
- name: Libraries | |
id: libraries | |
run: | | |
new_path=$(echo "${{ needs.linux.outputs.path }}" | sed 's/\;/\/lib\:/g') | |
echo "LD_LIBRARY_PATH=$new_path" >> $GITHUB_ENV | |
- name: Compile | |
run: | | |
gh auth setup-git | |
gh api https://api.github.com/repos/Geode-solutions/open-license-manager/contents/projects/geode/geode.lic -H "Accept: application/vnd.github.raw" > geode.lic | |
gh repo clone Geode-solutions/${{ matrix.repo }} | |
cd ${{ matrix.repo }} | |
if gh api repos/Geode-solutions/${{ matrix.repo }}/branches/${{ inputs.branch }} --silent; then | |
echo "found branch ${{ inputs.branch }}" | |
git checkout origin/${{ inputs.branch }} | |
else | |
echo "branch not found, checking base branch" | |
git checkout origin/${{ needs.validate-PRs.outputs.base }} | |
fi | |
mkdir -p build | |
cd build | |
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="${{ needs.linux.outputs.path }}" ../tests | |
cmake --build . | |
ctest --output-on-failure --no-tests=error -j 2 -LE unstable | |
env: | |
GEODE_LICENSE_LOCATION: ${{ github.workspace }}/geode.lic | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
shell: bash | |
- name: Post to a Slack channel | |
if: failure() | |
id: slack | |
uses: slackapi/slack-github-action@v1 | |
with: | |
channel-id: C0598GTCLGH | |
slack-message: "${{ inputs.branch }}: C++ merge request failed for ${{ matrix.repo }} on Linux\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
windows: | |
needs: validate-PRs | |
runs-on: windows-latest | |
outputs: | |
path: ${{ steps.repos.outputs.path }} | |
steps: | |
- uses: Geode-solutions/actions/get-release@master | |
id: repos | |
with: | |
repository: ${{ needs.validate-PRs.outputs.repos }} | |
file: "-win64-private.zip" | |
token: ${{ secrets.TOKEN }} | |
branch: ${{ inputs.branch }} | |
base: ${{ needs.validate-PRs.outputs.base }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows | |
path: . | |
windows-test: | |
needs: [validate-PRs, windows] | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
repo: ${{ fromJSON(needs.validate-PRs.outputs.repos_array) }} | |
fail-fast: false | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: windows | |
- name: Libraries | |
id: libraries | |
run: | | |
$old_path = "${{ needs.windows.outputs.path }}" | |
$bin_path = $old_path.replace(";", "\bin;").replace("\","/") + "/bin" | |
echo "bin=$bin_path" >> $env:GITHUB_OUTPUT | |
$share_path = $old_path.replace(";", "\share;").replace("\","/") + "/share" | |
echo "share=$share_path" >> $env:GITHUB_OUTPUT | |
- uses: TheMrMilchmann/setup-msvc-dev@v3 | |
with: | |
arch: x64 | |
- name: Compile & Test | |
run: | | |
gh auth setup-git | |
gh api https://api.github.com/repos/Geode-solutions/open-license-manager/contents/projects/geode/geode.lic -H "Accept: application/vnd.github.raw" > geode.lic | |
gh repo clone Geode-solutions/${{ matrix.repo }} | |
cd ${{ matrix.repo }} | |
if git ls-remote --exit-code --heads origin ${{ inputs.branch }}; then | |
echo "found branch ${{ inputs.branch }}" | |
git checkout origin/${{ inputs.branch }} | |
else | |
git checkout origin/${{ needs.validate-PRs.outputs.base }} | |
fi | |
mkdir -p build | |
cd build | |
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="${{ needs.windows.outputs.path }}" ../tests | |
IFS=";" read -a paths <<< "${{ steps.libraries.outputs.bin }}" | |
for path in "${paths[@]}" | |
do | |
if [[ -d $path ]]; then | |
cp $path/* bin | |
fi | |
done | |
mkdir share | |
IFS=";" read -a shares <<< "${{ steps.libraries.outputs.share }}" | |
for share in "${shares[@]}" | |
do | |
if [[ -d $share ]]; then | |
cp -r $share/* share | |
fi | |
done | |
cmake --build . | |
ctest --output-on-failure --no-tests=error -j 2 -LE unstable | |
env: | |
GEODE_LICENSE_LOCATION: ${{ github.workspace }}/geode.lic | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
shell: bash | |
- name: Post to a Slack channel | |
if: failure() | |
id: slack | |
uses: slackapi/slack-github-action@v1 | |
with: | |
channel-id: C0598GTCLGH | |
slack-message: "${{ inputs.branch }}: C++ merge request failed for ${{ matrix.repo }} on Windows\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
merge-PRs: | |
needs: [validate-PRs, linux-test, windows-test] | |
uses: Geode-solutions/Versions/.github/workflows/merge-pr.yml@master | |
with: | |
branch: ${{ inputs.branch }} | |
repos: ${{ needs.validate-PRs.outputs.repos }} | |
secrets: inherit | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [merge-PRs, validate-PRs] | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.TOKEN }} | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: 'Geode-solutions', | |
repo: 'Versions', | |
workflow_id: 'deploy.yml', | |
ref: 'master', | |
inputs: { branch: '${{ needs.validate-PRs.outputs.base }}', workflow: 'cpp' } | |
}) | |
- name: Post to a Slack channel | |
id: slack | |
uses: slackapi/slack-github-action@v1 | |
with: | |
channel-id: C0598GTCLGH | |
slack-message: "Merge request for ${{ inputs.branch }} complete :tada:" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |