Skip to content

Commit

Permalink
Mac x64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
koliyo committed Oct 7, 2023
1 parent 9bed39d commit b178909
Showing 1 changed file with 9 additions and 213 deletions.
222 changes: 9 additions & 213 deletions .github/workflows/build-and-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,222 +28,18 @@ on:
type: string

jobs:
build-devcontainer-linux:
name: "Build and test: ${{ matrix.host.os }}/${{ inputs.build-type }}"
strategy:
fail-fast: false
matrix:
host: [
{ type: linux, os: ubuntu-latest,
build-options: "--build-tests -Xswiftc -enable-testing",
test-options: "--enable-code-coverage"
}
]
# configuration: [ "debug", "release" ]

runs-on: ${{ matrix.host.os }}
build-native-macos-latest:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- run: uname -a

- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Create artifact directory
run: mkdir -p /home/runner/work/hylo-lsp/hylo-lsp/artifacts

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Test
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/koliyo/hylo-lsp-devcontainer:latest
runCmd: |
set -eo pipefail
cd hylo
swift package resolve
.build/checkouts/Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc
export PKG_CONFIG_PATH=$PWD
cd ..
swift build -c ${{ inputs.build-type }} ${{ matrix.host.build-options }}
BUILD_DIR=$(swift build -c ${{ inputs.build-type }} --show-bin-path)
# ls -l $BUILD_DIR
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
cp $BUILD_DIR/hylo-lsp-client $BUILD_DIR/hylo-lsp-server /artifacts/
# swift test -c ${{ inputs.build-type }} ${{ matrix.host.test-options }} |
# tee testoutput.txt && (
# (grep -q "[.']EndToEndTests[/. ]test_" testoutput.txt && grep -q "[.']HyloTests[/. ]test_" testoutput.txt) ||
# (echo "error: generated tests failed to run; see
# https://github.com/apple/swift-package-manager/issues/6595" && false) )
# - name: Check code coverage
# uses: mattpolzin/[email protected]
# with:
# SORT_ORDER: +cov
# MINIMUM_COVERAGE: 84
# CODECOV_JSON: .build/${{ inputs.build-type }}/codecov/*.json


- name: Upload Hylo LSP artifacts (${{ inputs.build-type }})
uses: actions/upload-artifact@v3
with:
name: hylo-lsp-artifacts-linux
path: |
artifacts/hylo-lsp-client
artifacts/hylo-lsp-server
build-native-macos:
name: "Build and test: ${{ matrix.host.os }}/${{ inputs.build-type }}"
strategy:
fail-fast: false
matrix:
host: [
{
type: macos, os: macos-13,
build-options: "--build-tests -Xswiftc -enable-testing",
# No coverage support on MacOS
test-options: ""
}
]
swift: [
{ version: "5.9" }
]
# configuration: [ $BUILD_TYPE ]
# configuration: [ "debug", "release" ]

runs-on: ${{ matrix.host.os }}
build-native-macos-13:
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Setup swift
uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift.version }}

- run: swift --version

- name: Setup LLVM
uses: KyleMayes/install-llvm-action@v1
with:
version: "15.0"

- run: llvm-config --version

- name: Generate LLVM pkgconfig file
run: |
set -eo pipefail
swift package resolve
.build/checkouts/Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc
cat llvm.pc
working-directory: hylo

- name: Build (${{ inputs.build-type }})
id: build
run: |
set -eo pipefail
export PKG_CONFIG_PATH=$PWD/hylo
swift build -c ${{ inputs.build-type }} ${{ matrix.host.build-options }}
BUILD_DIR=$(swift build -c ${{ inputs.build-type }} --show-bin-path)
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_ENV
# - name: Test (${{ inputs.build-type }})
# run: |
# set -eo pipefail
# export PKG_CONFIG_PATH=$PWD/hylo
# swift test -c ${{ inputs.build-type }} ${{ matrix.host.test-options }} |
# tee testoutput.txt && (
# (grep -q "[.']EndToEndTests[/. ]test_" testoutput.txt && grep -q "[.']HyloTests[/. ]test_" testoutput.txt) ||
# (echo "error: generated tests failed to run; see
# https://github.com/apple/swift-package-manager/issues/6595" && false) )
- run: uname -a

- name: Upload Hylo LSP artifacts (${{ inputs.build-type }})
uses: actions/upload-artifact@v3
with:
name: hylo-lsp-artifacts-mac
path: |
${{ env.BUILD_DIR }}/hylo-lsp-client
${{ env.BUILD_DIR }}/hylo-lsp-server
build-native-windows:
name: "Build and test: windows-latest/${{ inputs.build-type }}"
# strategy:
# fail-fast: false
runs-on: windows-latest
build-native-macos-13-xl:
runs-on: macos-13-xl
steps:
- name: Setup swift
uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.9-release
tag: 5.9-RELEASE

- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Swift version
run: swift --version

- name: Set up LLVM 15.0.6
run: |
curl.exe -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"https://github.com/c3lang/win-llvm/releases/download/llvm_15_0_6/llvm-15.0.6-windows-x86-msvc17-msvcrt.7z
7z x llvm-15.0.6-windows-x86-msvc17-msvcrt.7z -oC:\
Add-Content $env:GITHUB_PATH 'C:\llvm-15.0.6-windows-x86-msvc17-msvcrt\bin'
working-directory: hylo

- name: Copy LLVM's include and lib to include and lib folder of MSVC
run: |
xcopy c:\llvm-15.0.6-windows-x86-msvc17-msvcrt\include\*.* c:\program" "files\microsoft" "visual" "studio\2022\enterprise\vc\tools\msvc\${{ env.VCToolsVersion }}\include\ /s /h
xcopy c:\llvm-15.0.6-windows-x86-msvc17-msvcrt\lib\*.* c:\program" "files\microsoft" "visual" "studio\2022\enterprise\vc\tools\msvc\${{ env.VCToolsVersion }}\lib\x64\ /s /h
working-directory: hylo

- run: llvm-config --version

- name: Build support library
run: clang -c ./Library/Hylo/LibC.c -o HyloLibC.lib
working-directory: hylo

- name: Copy support library
run: xcopy HyloLibC.lib c:\program" "files\microsoft" "visual" "studio\2022\enterprise\vc\tools\msvc\${{ env.VCToolsVersion }}\lib\x64\
working-directory: hylo

- name: Build (Release)
id: build
# continue-on-error: true
run: |
$BUILD_DIR = swift build -c ${{ inputs.build-type }} --show-bin-path
echo BUILD_DIR=$BUILD_DIR
echo BUILD_DIR=$BUILD_DIR >> $env:GITHUB_ENV
swift build -c ${{ inputs.build-type }}
# - name: Copy artifacts
# run: |
# $BUILD_DIR = swift build -c ${{ inputs.build-type }} --show-bin-path
# xcopy $BUILD_DIR artifacts /I

- name: Upload Hylo LSP artifacts (${{ inputs.build-type }})
uses: actions/upload-artifact@v3
with:
name: hylo-lsp-artifacts-windows
path: |
${{ env.BUILD_DIR }}/hylo-lsp-client.exe
${{ env.BUILD_DIR }}/hylo-lsp-server.exe
# artifacts/hylo-lsp-client.exe
# artifacts/hylo-lsp-server.exe

# - name: Retry on failure
# continue-on-error: false
# if: steps.build.outcome != 'success'
# run: swift build -v -c release

- run: uname -a

0 comments on commit b178909

Please sign in to comment.