Skip to content

Commit 8332998

Browse files
authored
Merge pull request #20 from etcwilde/ewilde/pr-testing
Testing: Set up PR testing action
2 parents dbdaca5 + b077313 commit 8332998

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Install CMake'
2+
description: 'Download and configure CMake'
3+
inputs:
4+
url:
5+
description: "URL of CMake bundle to download"
6+
hash:
7+
description: "Expected bundle hash"
8+
install_dir:
9+
description: "Location where to install the CMake bundle"
10+
default: /tmp/cmake
11+
12+
outputs:
13+
cmake:
14+
description: "Path to the installed CMake executable."
15+
value: ${{ steps.unpack-cmake.outputs.cmake-path }}
16+
ctest:
17+
description: "Path to the installed CMake ctest executable."
18+
value: ${{ steps.unpack-cmake.outputs.ctest-path }}
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Download CMake
23+
shell: bash
24+
run: |
25+
curl -Llo /tmp/cmake.tar.gz "${{ inputs.url }}"
26+
- name: Verify CMake
27+
shell: bash
28+
run:
29+
echo "${{ inputs.hash }} /tmp/cmake.tar.gz" | shasum -a 256 -c-
30+
- name: Unpack CMake
31+
shell: bash
32+
id: unpack-cmake
33+
run: |
34+
mkdir "${{ inputs.install_dir }}"
35+
tar xf /tmp/cmake.tar.gz --strip-components=1 -C "${{ inputs.install_dir }}"
36+
echo "cmake-path=${{ inputs.install_dir }}/bin/cmake" >> "$GITHUB_OUTPUT"
37+
echo "ctest-path=${{ inputs.install_dir }}/bin/ctest" >> "$GITHUB_OUTPUT"

.github/workflows/pull_request.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Pull Request
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
11+
jobs:
12+
smoke_test:
13+
name: Smoke Test
14+
runs-on: ubuntu-latest
15+
container: swift:6.1-bookworm
16+
strategy:
17+
matrix:
18+
cmake:
19+
- url: "https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6-linux-x86_64.tar.gz"
20+
hash: 09e1b34026c406c5bf4d1b053eadb3a8519cb360e37547ebf4b70ab766d94fbc
21+
- url: "https://github.com/Kitware/CMake/releases/download/v3.26.6/cmake-3.26.6-linux-x86_64.tar.gz"
22+
hash: 2dd48ccd3e3d872ee4cc916f3f4e24812612421007e895f82bf9fc7e49831d62
23+
- url: "https://github.com/Kitware/CMake/releases/download/v3.30.8/cmake-3.30.8-linux-x86_64.tar.gz"
24+
hash: adc81f2944e6f86b44e86acea3abea1651ed7890206933484b8b74ac1280314f
25+
steps:
26+
- name: Clone Repo
27+
uses: actions/checkout@v4
28+
with:
29+
path: ./swift-cmake-examples
30+
- name: Install Dependencies
31+
shell: bash
32+
run: apt update && apt install -y curl ninja-build
33+
- name: Setup CMake
34+
id: install-cmake
35+
uses: ./swift-cmake-examples/.github/actions/cmake-action
36+
with:
37+
url: ${{ matrix.cmake.url }}
38+
hash: ${{ matrix.cmake.hash }}
39+
- name: Run Tests
40+
shell: bash
41+
run: |
42+
"${{ steps.install-cmake.outputs.cmake }}" -G Ninja -B test -S swift-cmake-examples -DCMAKE_BUILD_TYPE=Release
43+
"${{ steps.install-cmake.outputs.ctest }}" --output-on-failure --test-timeout 150 --test-dir test -j

0 commit comments

Comments
 (0)