Skip to content

[pre-commit.ci] pre-commit autoupdate #136

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #136

Workflow file for this run

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
tag:
description: 'The new version to tag, ex: 1.0.5'
required: true
type: string
name: Continuous integration
env:
SWIFT_VERSION: 6.1
jobs:
build:
name: Test ${{ matrix.os }}
strategy:
matrix:
os:
- macos-15
runs-on: ${{ matrix.os }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: "List Xcode versions"
if: matrix.os == 'macos-15'
run: ls /Applications | grep Xcode
- name: "Select Xcode version"
if: matrix.os == 'macos-15'
run: sudo xcode-select -s /Applications/Xcode_16.3.app
- name: "Print Xcode version"
if: matrix.os == 'macos-15'
run: xcodebuild -version
- name: "Install build dependencies"
if: matrix.os == 'macos-15'
run: brew install ninja
- name: Restore LLVM cache
id: llvm-cache
uses: actions/cache@v4
with:
path: llvm
key: ${{ runner.os }}-llvm-cache-${{ env.SWIFT_VERSION }}-bump3
- name: "LLVM: Download"
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: wget https://github.com/swiftlang/llvm-project/archive/refs/tags/swift-${{ env.SWIFT_VERSION }}-RELEASE.tar.gz
- name: "LLVM: Decompress"
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: |
tar -xzf swift-${{ env.SWIFT_VERSION }}-RELEASE.tar.gz
mv llvm-project-swift-${{ env.SWIFT_VERSION }}-RELEASE llvm
rm swift-${{ env.SWIFT_VERSION }}-RELEASE.tar.gz
- name: "LLVM: CMake"
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: cd llvm && mkdir build && cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang' -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DLLVM_PARALLEL_LINK_JOBS=2 -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DLLVM_USE_STATIC_ZSTD=ON
- name: "LLVM: Build"
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: cd llvm/build && ninja libIndexStore.dylib FileCheck
- name: "index-import: CMake"
run: mkdir build && cmake -B build -G Ninja -DClang_DIR=./llvm/build/lib/cmake/clang/ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
- name: "index-import: Build"
run: cd build && ninja
- name: "index-import: test"
run: |
PATH=$PWD/llvm/build/bin:$PATH ./tests/run.sh
- name: "index-import: archive"
run: |
cd build
COPYFILE_DISABLE=1 tar czvf index-import.tar.gz absolute-unit index-import
- name: "index-import: upload"
uses: actions/upload-artifact@v4
with:
path: build/index-import.tar.gz
create-release:
name: Create release
needs: build
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Download index-import artifact
uses: actions/download-artifact@v4
- name: Create release
run: |
set -euo pipefail
macos_archive="index-import.tar.gz"
mv "artifact/index-import.tar.gz" "$macos_archive"
./.github/generate-notes.sh "$SWIFT_VERSION" "$macos_archive" | tee notes.md
gh release create "$TAG" --title "$TAG" --target "$GITHUB_REF_NAME" --notes-file notes.md "$macos_archive"
env:
TAG: ${{ inputs.tag }}
SWIFT_VERSION: ${{ env.SWIFT_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For local development, use the playground at
# https://rhysd.github.io/actionlint/
actionlint:
name: Actionlint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: raven-actions/actionlint@v2
with:
shellcheck: false