forked from zigtools/zls
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'zigtools:master' into completion-label-details
- Loading branch information
Showing
28 changed files
with
342 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Deploy release artifacts | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
if: github.repository_owner == 'zigtools' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # required to resolve the version string | ||
|
||
- uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: master | ||
|
||
- run: zig env | ||
|
||
- name: Build artifacts | ||
run: | | ||
mkdir -p artifacts/master | ||
zig build release -Dcpu=baseline -Doptimize=ReleaseSafe --prefix artifacts/master --summary all | ||
zls_version=$(artifacts/master/x86_64-linux/zls --version) | ||
mkdir -p "artifacts/$zls_version/" | ||
cp -r artifacts/master/* "artifacts/$zls_version/" | ||
wget https://zigtools-releases.nyc3.digitaloceanspaces.com/zls/index.json | ||
cp index.json artifacts/old-index.json | ||
for file in artifacts/master/*; do | ||
targets+=("${file#artifacts/master/}") | ||
done | ||
jq \ | ||
--arg targets "${targets[*]}" \ | ||
--arg zig_version "$(zig version)" \ | ||
--arg zls_version "$(artifacts/master/x86_64-linux/zls --version)" \ | ||
--arg zls_minimum_build_version "$(artifacts/master/x86_64-linux/zls --minimum-build-version)" \ | ||
'.latest = $zls_version | .versions[$zls_version] = { | ||
"date": now | todateiso8601, | ||
"builtWithZigVersion": $zig_version, | ||
"zlsVersion": $zls_version, | ||
"zlsMinimumBuildVersion": $zls_minimum_build_version, | ||
"commit": "${{ github.sha }}", | ||
"targets": ($targets / " "), | ||
}' index.json > artifacts/index.json | ||
- uses: BetaHuhn/do-spaces-action@v2 | ||
with: | ||
access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }} | ||
secret_key: ${{ secrets.DO_SPACES_SECRET_KEY }} | ||
space_name: zigtools-releases | ||
space_region: nyc3 | ||
source: artifacts/ | ||
out_dir: zls/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,153 +1,30 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
paths: | ||
- ".github/workflows/main.yml" | ||
- "**.zig" | ||
- "build.zig.zon" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/main.yml" | ||
- "**.zig" | ||
- "build.zig.zon" | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
if: github.repository_owner == 'zigtools' | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: master | ||
|
||
- name: Get Zig version | ||
id: zig_version | ||
run: echo "zig_version=$(zig version)" >> $GITHUB_OUTPUT | ||
|
||
- run: zig env | ||
|
||
- name: Run zig fmt | ||
run: zig fmt --check . | ||
|
||
- name: Build | ||
run: zig build | ||
|
||
- name: Get ZLS version and mimimum build version | ||
id: zls_version | ||
run: | | ||
echo "zls_version=$(./zig-out/bin/zls --version)" >> $GITHUB_OUTPUT | ||
echo "zls_minimum_build_version=$(./zig-out/bin/zls --minimum-build-version)" >> $GITHUB_OUTPUT | ||
- name: Run Tests | ||
run: zig build test | ||
|
||
- name: Build artifacts | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-linux" "aarch64-macos" "wasm32-wasi") | ||
mkdir -p "artifacts/${{ steps.zls_version.outputs.zls_version }}/" | ||
for target in "${targets[@]}"; do | ||
mkdir -p artifacts/${{ steps.zls_version.outputs.zls_version }}/$target | ||
echo "Building target ${target}..." | ||
if [ "${GITHUB_REF##*/}" == "master" ]; then | ||
echo "Building safe" | ||
zig build -Dtarget=${target} -Dcpu=baseline -Doptimize=ReleaseSafe --prefix artifacts/${{ steps.zls_version.outputs.zls_version }}/${target}/ | ||
else | ||
echo "Building debug as action is not running on master" | ||
zig build -Dtarget=${target} -Dcpu=baseline --prefix artifacts/${{ steps.zls_version.outputs.zls_version }}/${target}/ | ||
fi | ||
mv artifacts/${{ steps.zls_version.outputs.zls_version }}/${target}/bin/* artifacts/${{ steps.zls_version.outputs.zls_version }}/${target} | ||
rmdir artifacts/${{ steps.zls_version.outputs.zls_version }}/${target}/bin | ||
done | ||
wget https://zigtools-releases.nyc3.digitaloceanspaces.com/zls/index.json | ||
cp index.json artifacts/old-index.json | ||
jq --arg targets "${targets[*]}" '.latest = "${{ steps.zls_version.outputs.zls_version }}" | .versions["${{ steps.zls_version.outputs.zls_version }}"] = { | ||
"date": now | todateiso8601, | ||
"builtWithZigVersion": "${{ steps.zig_version.outputs.zig_version }}", | ||
"zlsVersion": "${{ steps.zls_version.outputs.zls_version }}", | ||
"zlsMinimumBuildVersion": "${{ steps.zls_version.outputs.zls_minimum_build_version }}", | ||
"commit": "${{ github.sha }}", | ||
"targets": ($targets / " "), | ||
}' index.json > artifacts/index.json | ||
- name: Upload x86_64-windows artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-x86_64-windows | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/x86_64-windows/ | ||
|
||
- name: Upload x86_64-linux artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-x86_64-linux | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/x86_64-linux/ | ||
|
||
- name: Upload x86_64-macos artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-x86_64-macos | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/x86_64-macos/ | ||
|
||
- name: Upload x86-windows artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-x86-windows | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/x86-windows/ | ||
|
||
- name: Upload x86-linux artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-x86-linux | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/x86-linux/ | ||
|
||
- name: Upload aarch64-linux artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-aarch64-linux | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/aarch64-linux/ | ||
|
||
- name: Upload aarch64-macos artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-aarch64-macos | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/aarch64-macos/ | ||
|
||
- name: Upload wasm32-wasi artifact | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: zls-wasm32-wasi | ||
path: artifacts/${{ steps.zls_version.outputs.zls_version }}/wasm32-wasi/ | ||
|
||
- uses: BetaHuhn/do-spaces-action@v2 | ||
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' }} | ||
with: | ||
access_key: ${{ secrets.DO_SPACES_ACCESS_KEY }} | ||
secret_key: ${{ secrets.DO_SPACES_SECRET_KEY }} | ||
space_name: zigtools-releases | ||
space_region: nyc3 | ||
source: artifacts/ | ||
out_dir: zls/ | ||
name: CI | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
if: github.repository_owner == 'zigtools' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: goto-bus-stop/setup-zig@v2 | ||
with: | ||
version: master | ||
|
||
- run: zig env | ||
|
||
- name: Run zig fmt | ||
run: zig fmt --check . | ||
|
||
- name: Run Tests | ||
run: zig build test --summary all |
Oops, something went wrong.