Skip to content

Commit

Permalink
refactor: use custom prebuild llvm distribution on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Aug 23, 2020
1 parent 7147826 commit 5e20dcc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
9 changes: 8 additions & 1 deletion .github/actions/install-llvm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,14 @@ async function execute(cmd) {
(async () => {
try {
if(isLinux) {
await exec.exec("sudo apt install llvm-8 llvm-8-* liblld-8*");
let llvmCachedPath = tc.find("llvm", "8.0.1", "linux");
if(!llvmCachedPath) {
llvmCachedPath = await tc.downloadTool("https://github.com/mun-lang/build-support/releases/download/llvm-8.0.1/llvm-8.0.1-ubuntu-12.04-bionic.tar.xz")
.then(downloadPath => tc.extractTar(downloadPath, null))
.then(extractPath => tc.cacheDir(extractPath, "llvm", "8.0.1", "linux"));
}
core.addPath(`${llvmCachedPath}/bin`)
core.exportVariable('LIBCLANG_PATH', `${llvmCachedPath}/bin`)
} else if(isMacOS) {
await exec.exec("brew install llvm@8")
let llvmPath = await execute("brew --prefix llvm@8");
Expand Down
9 changes: 8 additions & 1 deletion .github/actions/install-llvm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ export async function execute(cmd) {
(async () => {
try {
if(isLinux) {
await exec.exec("sudo apt install llvm-8 llvm-8-* liblld-8*");
let llvmCachedPath = tc.find("llvm", "8.0.1", "linux");
if(!llvmCachedPath) {
llvmCachedPath = await tc.downloadTool("https://github.com/mun-lang/build-support/releases/download/llvm-8.0.1/llvm-8.0.1-ubuntu-12.04-bionic.tar.xz")
.then(downloadPath => tc.extractTar(downloadPath, null))
.then(extractPath => tc.cacheDir(extractPath, "llvm", "8.0.1", "linux"));
}
core.addPath(`${llvmCachedPath}/bin`)
core.exportVariable('LIBCLANG_PATH', `${llvmCachedPath}/bin`)
} else if(isMacOS) {
await exec.exec("brew install llvm@8")
let llvmPath = await execute("brew --prefix llvm@8");
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

check:
name: Check
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -38,9 +38,9 @@ jobs:
fail-fast: false
matrix:
config:
- { os: "ubuntu-latest", toolchain: "stable"}
- { os: "ubuntu-latest", toolchain: "beta"}
- { os: "ubuntu-latest", toolchain: "nightly"}
- { os: "ubuntu-20.04", toolchain: "stable"}
- { os: "ubuntu-20.04", toolchain: "beta"}
- { os: "ubuntu-20.04", toolchain: "nightly"}
- { os: "windows-2016", toolchain: "stable"}
- { os: "macOS-latest", toolchain: "stable"}
steps:
Expand All @@ -60,22 +60,22 @@ jobs:
uses: ./.github/actions/install-llvm

- name: Cargo build
if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
if: ${{ matrix.config.os == 'ubuntu-20.04' && matrix.config.toolchain == 'stable' }}
uses: actions-rs/cargo@v1
continue-on-error: ${{ matrix.config.toolchain == 'nightly' }}
with:
command: build

- name: Install mdbook
if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
if: ${{ matrix.config.os == 'ubuntu-20.04' && matrix.config.toolchain == 'stable' }}
uses: actions-rs/[email protected]
with:
crate: mdbook
version: latest
use-tool-cache: true

- name: mdbook test
if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.toolchain == 'stable' }}
if: ${{ matrix.config.os == 'ubuntu-20.04' && matrix.config.toolchain == 'stable' }}
run: mdbook test book -L target/debug/deps

- name: Cargo test
Expand All @@ -87,7 +87,7 @@ jobs:

style:
name: Check Style
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs: check
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
args: --all-features

tarpaulin:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs: check
steps:
- uses: actions/checkout@v2
Expand Down

0 comments on commit 5e20dcc

Please sign in to comment.