Bump actions/checkout from 3 to 4 #193
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
# SPDX-License-Identifier: Apache-2.0 OR MIT | |
# | |
# SPDX-FileCopyrightText: Copyright 2022 Micron Technology, Inc. | |
name: Builds | |
on: | |
release: | |
types: [created] | |
push: | |
branches: | |
- master | |
- "v[0-9]+.[0-9]+" | |
paths: | |
- "**.pxd" | |
- "**.py" | |
- "**.pyi" | |
- "**.pyx" | |
- "**/meson.build" | |
- "cross/*.ini" | |
- "subprojects/*.wrap" | |
- .github/workflows/builds.yaml | |
- meson_options.txt | |
- VERSION | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- "**.pxd" | |
- "**.py" | |
- "**.pyi" | |
- "**.pyx" | |
- "**/meson.build" | |
- "cross/*.ini" | |
- "subprojects/*.wrap" | |
- .github/workflows/builds.yaml | |
- meson_options.txt | |
- VERSION | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
permissions: | |
packages: read | |
env: | |
MESON_TESTTHREADS: 1 | |
jobs: | |
determine-tag: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
outputs: | |
tag: ${{ steps.determine-tag.outputs.tag }} | |
steps: | |
- name: Determine tag | |
id: determine-tag | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | |
echo "tag=$GITHUB_BASE_REF" >> "$GITHUB_OUTPUT" | |
else | |
echo "tag=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT" | |
fi | |
normal: | |
runs-on: ubuntu-latest | |
needs: | |
- determine-tag | |
container: | |
image: ghcr.io/hse-project/ci-images/${{ matrix.image }}:${{ needs.determine-tag.outputs.tag }} | |
strategy: | |
fail-fast: false | |
matrix: | |
image: | |
- almalinux-8 | |
- almalinux-9 | |
- cross-s390x | |
- fedora-37 | |
- ubuntu-18.04 | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
buildtype: [release, debug] | |
steps: | |
- name: To skip or not to skip | |
id: to-skip | |
shell: sh +e {0} | |
run: | | |
skip="false" | |
echo "${{ matrix.image }}" | grep -P --quiet "(almalinux-8|almalinux-9|ubuntu-20.04|ubuntu-22.04)" | |
if [ $? -eq 0 ] && [ "$GITHUB_EVENT_NAME" != "release" ]; then | |
skip="true" | |
fi | |
echo "skip=$skip" >> "GITHUB_OUTPUT" | |
- name: Checkout hse-python | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
uses: actions/checkout@v4 | |
- name: Determine branches | |
id: determine-branches | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
shell: sh +e {0} | |
run: | | |
for p in hse; do | |
branch=master | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | |
git ls-remote --exit-code --heads \ | |
"https://github.com/hse-project/$p.git" "$GITHUB_HEAD_REF" \ | |
> /dev/null | |
if [ $? -eq 0 ]; then | |
branch="$GITHUB_HEAD_REF" | |
fi | |
elif [ "$GITHUB_EVENT_NAME" = "release" ]; then | |
branch="$GITHUB_REF_NAME" | |
else | |
git ls-remote --exit-code --heads \ | |
"https://github.com/hse-project/$p.git" "$GITHUB_REF" \ | |
> /dev/null | |
if [ $? -eq 0 ]; then | |
branch="$GITHUB_REF_NAME" | |
fi | |
fi | |
echo "$p=$branch" >> "GITHUB_OUTPUT" | |
done | |
- name: Checkout HSE | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: hse-project/hse | |
path: subprojects/hse | |
ref: ${{ steps.determine-branches.outputs.hse }} | |
- name: Cache Meson packagecache | |
id: meson-packagecache | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
uses: actions/cache@v3 | |
with: | |
path: subprojects/packagecache | |
key: meson-packagecache-${{ matrix.image }}-${{ hashFiles('subprojects/hse/subprojects/*.wrap') }} | |
- name: Export cross arguments | |
if: ${{ steps.to-skip.outputs.skip == 'false' && startsWith(matrix.image, 'cross') }} | |
run: | | |
image="${{ matrix.image }}" | |
echo "CROSS_ARGS=--cross-file cross/${image##*-}.ini --cross-file cross/common.ini" >> "$GITHUB_ENV" | |
- name: Setup | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
run: | | |
meson setup builddir --buildtype=${{ matrix.buildtype }} $CROSS_ARGS \ | |
--werror | |
- name: Build | |
if: ${{ steps.to-skip.outputs.skip == 'false' }} | |
run: | | |
ninja -C builddir | |
- name: Test | |
if: ${{ steps.to-skip.outputs.skip == 'false' && !startsWith(matrix.image, 'cross') }} | |
run: | | |
meson test -C builddir --setup=ci --print-errorlogs --no-stdsplit | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: ${{ matrix.image }}-${{ matrix.buildtype }} | |
path: builddir/meson-logs/ |