Github syntax #6
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
name: Check Vectorization by Compiler | |
on: [push, pull_request] | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
FILE: src/util/sample.cpp | |
jobs: | |
build: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { | |
os: ubuntu-latest, | |
compiler: gcc, | |
flags: "-O3 -ftree-vectorize -fopt-info-vec-optimized", | |
} | |
- { | |
os: macOS-latest, | |
compiler: clang, | |
flags: "-O3 -Rpass=loop-vectorize", | |
} | |
- { os: windows-latest, compiler: cl, flags: "/O2 /Qvec-report:2" } | |
steps: | |
- name: "Check out repository" | |
uses: actions/checkout@v4.1.6 | |
with: | |
# This is necessary for making `git describe` work. | |
fetch-depth: 0 | |
- name: "Ensure that all tags are fetched" | |
# Works around an issue where not the latest tag is not fetched when the | |
# workflow is triggered by a tag push event. | |
# Possibly related: actions/checkout#290 | |
run: git fetch origin --force --tags | |
- name: Set up compiler | |
run: | | |
if [ "${{ matrix.config.compiler }}" = "gcc" ]; then | |
sudo apt-get install -y ${{ matrix.config.compiler }} | |
fi | |
- name: Compile and check vectorization | |
id: check | |
shell: bash | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
OUTPUT=$(pwsh -File ./tools/check_vectorization.ps1 "${{ matrix.config.compiler }}" "${{ matrix.config.flags }}" "${{ env.FILE }}") | |
echo "result=$OUTPUT" >> $GITHUB_ENV | |
else | |
OUTPUT=$(./tools/check_vectorization.sh "${{ matrix.config.compiler }}" ${matrix.config.flags} "${{ env.FILE }}") | |
echo "result=$OUTPUT" >> $GITHUB_ENV | |
fi | |
- name: Print result | |
run: echo "${{ env.result }}" | |
report: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create report | |
run: | | |
echo "OS, Compiler, Function, Vectorized" | |
echo "${{ needs.build.outputs.result }}" |