Skip to content

Commit

Permalink
Improve Github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
KapJI committed Nov 14, 2024
1 parent 9562685 commit d1f349e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 36 deletions.
10 changes: 9 additions & 1 deletion .github/actions/build_debug/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ runs:
using: composite
steps:
- name: Build buck2 binary (debug)
if: {{ runner.os != 'Windows' }}
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 -Z unstable-options --out-dir=$RUNNER_TEMP/artifacts
cargo build --bin=buck2 -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: bash
- name: Build buck2 binary (debug)
if: {{ runner.os == 'Windows' }}
working-directory: ${{ env.DEV_DRIVE }}/buck2
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: pwsh
11 changes: 10 additions & 1 deletion .github/actions/build_release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ runs:
using: composite
steps:
- name: Build buck2 binary (release)
if: {{ runner.os != 'Windows' }}
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 --release -Z unstable-options --out-dir=$RUNNER_TEMP/artifacts
cargo build --bin=buck2 --release -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: bash
- name: Build buck2 binary (release)
if: {{ runner.os == 'Windows' }}
working-directory: ${{ env.DEV_DRIVE }}/buck2
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 --release -Z unstable-options --artifact-dir=$RUNNER_TEMP/artifacts
shell: pwsh

4 changes: 2 additions & 2 deletions .github/actions/setup_linux_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Setup Linux environment
runs:
using: composite
steps:
- uses: SebRollen/toml-action@v1.0.2
- uses: SebRollen/toml-action@v1.2.0
id: read_rust_toolchain
with:
file: rust-toolchain
Expand All @@ -25,7 +25,7 @@ runs:
- name: Install conan
run: sudo pip3 install conan==1.*
shell: bash
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: false
go-version: '~1.22.0'
14 changes: 10 additions & 4 deletions .github/actions/setup_macos_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ description: Setup macOS environment
runs:
using: composite
steps:
- name: Install Rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=none
shell: bash
- uses: SebRollen/[email protected]
id: read_rust_toolchain
with:
file: rust-toolchain
field: toolchain.channel
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.read_rust_toolchain.outputs.value }}
components: clippy
- name: Brew install
run: brew install cmake python3 coreutils opam llvm protobuf zstd
shell: bash
- name: Install conan
run: sudo pip3 install --break-system-packages conan==1.*
shell: bash
- uses: "./.github/actions/print_versions"
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: false
go-version: '~1.22.0'
- uses: haskell-actions/setup@v2
with:
Expand Down
38 changes: 20 additions & 18 deletions .github/actions/setup_windows_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ description: Setup Windows environment for building and testing
runs:
using: composite
steps:
- name: Install Rustup
- uses: samypr100/setup-dev-drive@v3
with:
env-mapping: |
CARGO_HOME,{{ DEV_DRIVE }}/cargo
RUSTUP_HOME,{{ DEV_DRIVE }}/rustup
TEMP,{{ DEV_DRIVE }}/temp
TMP,{{ DEV_DRIVE }}/temp
- name: Copy Git Repo to Dev Drive
run: |
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/buck2" -Recurse
shell: pwsh
- name: Write Visual Studio path
run: |-
choco install -y rustup.install
write-output "[net]`ngit-fetch-with-cli = true" | out-file -append -encoding utf8 $Env:USERPROFILE/.cargo/config.toml
type $Env:USERPROFILE/.cargo/config.toml
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath
Join-Path $vsPath "VC\Tools\Llvm\x64\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
shell: pwsh
- name: Create python3 symlink
run: New-Item -ItemType SymbolicLink -Path C:\ProgramData\chocolatey\bin\python3.exe -Target $(Get-Command python).Source
run: |
New-Item -ItemType SymbolicLink -Path C:\ProgramData\chocolatey\bin\python3.exe -Target $(Get-Command python).Source
shell: pwsh
- name: Write Powershell profile
run: |-
$psProfileContent = @'
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath
$llvmPath = Join-Path $vsPath "VC\Tools\Llvm\x64\bin"
$env:PATH = "$env:USERPROFILE\.cargo\bin;$llvmPath;" + $env:PATH
$env:TEMP = "$env:USERPROFILE\temp"
$env:TMP = $env:TEMP
'@
Add-Content "$PsHome\profile.ps1" $psProfileContent
New-Item -ItemType Directory -Path "$env:USERPROFILE\temp"
- name: Install Rust toolchain
working-directory: ${{ env.DEV_DRIVE }}/buck2
run: rustup component add clippy
shell: pwsh
- uses: "./.github/actions/print_versions"
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: false
go-version: '~1.22.0'
6 changes: 0 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,5 @@ jobs:
& $Env:RUNNER_TEMP/artifacts/buck2 build //... -v 2
& $Env:RUNNER_TEMP/artifacts/buck2 test //... -v 2
- uses: ./.github/actions/build_example_no_prelude
- name: Configure CARGO_HOME
run: |-
echo CARGO_HOME=$GITHUB_WORKSPACE/.cargo >> $GITHUB_ENV
echo $GITHUB_WORKSPACE/.cargo/bin >> $GITHUB_PATH
shell:
bash
- uses: ./.github/actions/setup_reindeer
- uses: ./.github/actions/build_bootstrap
8 changes: 4 additions & 4 deletions .github/workflows/upload_buck2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
runs-on: ${{ matrix.target.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: SebRollen/[email protected]
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- get_prelude_hash
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Publish a new tag and upload all aritfacts from `build` and `get_prelude_hash`
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:
# Only perform this action if check_for_bi_monthly_release set a tag output
if: ${{ needs.check_for_bi_monthly_release.outputs.tag }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Publish a new tag and upload all aritfacts from `build` and `get_prelude_hash`
Expand All @@ -218,7 +218,7 @@ jobs:
- build
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download Buck2
uses: actions/download-artifact@v4
with:
Expand Down

0 comments on commit d1f349e

Please sign in to comment.