Skip to content

Commit

Permalink
Merge branch 'zigtools:master' into completion-label-details
Browse files Browse the repository at this point in the history
  • Loading branch information
diocletiann authored Feb 13, 2024
2 parents d96f543 + 88a352a commit 79b48f0
Show file tree
Hide file tree
Showing 28 changed files with 342 additions and 343 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/artifacts.yml
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/
10 changes: 2 additions & 8 deletions .github/workflows/build_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ on:
paths:
- ".github/workflows/build_runner.yml"
- "src/build_runner/**"
pull_request:
paths:
- ".github/workflows/build_runner.yml"
- "src/build_runner/**"
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
Expand All @@ -27,9 +23,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Grab zig
uses: goto-bus-stop/setup-zig@v2
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
name: Code Coverage

on: [push, pull_request]
on:
push:

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/checkout@v4

- uses: goto-bus-stop/setup-zig@v2
with:
version: master

- run: zig version
- run: zig env

- name: Build
run: zig build

- name: Install kcov
run: |
wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz
Expand All @@ -29,13 +23,12 @@ jobs:
- name: Run Tests with kcov
run: |
kcov --version
zig build test -Dgenerate_coverage
zig build test -Dgenerate_coverage --summary all
- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: zig-out/kcov/kcov-merged
directory: zig-out/coverage/kcov-merged
fail_ci_if_error: true
verbose: true

17 changes: 6 additions & 11 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,24 @@ jobs:
- run: zig env

- name: Checkout zig
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: zig
repository: "ziglang/zig"
fetch-depth: 0

- name: Checkout zls (non-PR)
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: zls
fetch-depth: 0
path: zls

- name: Checkout zls (PR)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: zls
fetch-depth: 0
path: zls
ref: "refs/pull/${{ github.event.number }}/merge"

- name: Build zls
Expand All @@ -83,11 +82,10 @@ jobs:
zig build
- name: Checkout sus
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: sus
repository: "zigtools/sus"
fetch-depth: 0

- name: Build sus
run: |
Expand Down Expand Up @@ -117,6 +115,3 @@ jobs:
space_region: nyc3
source: sus/saved_logs/
out_dir: ${{ github.event.pull_request.head.repo.full_name || github.repository }}/${{ github.head_ref || github.ref_name }}/${{ github.event.pull_request.head.sha || github.sha }}



183 changes: 30 additions & 153 deletions .github/workflows/main.yml
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
Loading

0 comments on commit 79b48f0

Please sign in to comment.