diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8e7dd6c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + + - name: checkout + uses: actions/checkout@v4 + + - name: setup-apt-llvm + uses: ./ + + - name: test-apt-llvm + run: | + sudo apt install -y \ + clang-19 \ + clang-18 \ + clang-17 \ + clang-16 diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..5f4a910 --- /dev/null +++ b/action.yml @@ -0,0 +1,8 @@ +name: setup-apt-llvm +description: Setup apt.llvm.org repositories +runs: + using: composite + steps: + - if: ${{ runner.os == 'Linux' }} + run: ${{ github.action_path }}/setup.sh + shell: bash diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..ac6bc09 --- /dev/null +++ b/setup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +LSB_CODENAME=$(lsb_release -cs) + +curl -f -L --retry 5 https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg + +{ + echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/$LSB_CODENAME llvm-toolchain-$LSB_CODENAME main" + echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/$LSB_CODENAME llvm-toolchain-$LSB_CODENAME-18 main" + echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/$LSB_CODENAME llvm-toolchain-$LSB_CODENAME-17 main" + echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/$LSB_CODENAME llvm-toolchain-$LSB_CODENAME-16 main" +} | sudo tee /etc/apt/sources.list.d/llvm-toolchain.list + +sudo apt update