Revert "Fix Nix build, add Nix to CI (#840)" (#893)

This reverts commit 20ba87c173.
This commit is contained in:
Auguste Rame 2023-01-07 18:14:45 -05:00 committed by GitHub
parent e9b364772d
commit 48288e02a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 141 deletions

View File

@ -1,137 +1,120 @@
name: CI name: CI
on: on:
push: push:
paths: paths:
- "**.zig" - "**.zig"
- "flake.*" pull_request:
pull_request: paths:
paths: - "**.zig"
- "**.zig" schedule:
- "flake.*" - cron: "0 0 * * *"
schedule: workflow_dispatch:
- cron: "0 0 * * *"
workflow_dispatch: jobs:
build:
jobs: strategy:
build: matrix:
strategy: os: [ubuntu-latest, macos-latest, windows-latest]
matrix: runs-on: ${{ matrix.os }}
os: [ubuntu-latest, macos-latest, windows-latest] steps:
runs-on: ${{ matrix.os }} - uses: actions/checkout@v3
steps: with:
- uses: actions/checkout@v3 fetch-depth: 0
with: submodules: true
fetch-depth: 0 - uses: goto-bus-stop/setup-zig@v2
submodules: true with:
- uses: goto-bus-stop/setup-zig@v2 version: master
with:
version: master - run: zig version
- run: zig env
- run: zig version
- run: zig env - name: Build
run: zig build
- name: Build
run: zig build - name: Build with Tracy
if: ${{ matrix.os != 'macos-latest' }}
- name: Build with Tracy run: zig build -Denable_tracy -Denable_tracy_allocation
if: ${{ matrix.os != 'macos-latest' }}
run: zig build -Denable_tracy -Denable_tracy_allocation - name: Run Tests
run: zig build test
- name: Run Tests
run: zig build test - name: Build artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Build artifacts run: |
if: ${{ matrix.os == 'ubuntu-latest' }} declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-linux" "aarch64-macos")
run: | mkdir -p "artifacts/"
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-linux" "aarch64-macos")
mkdir -p "artifacts/" for target in "${targets[@]}"; do
mkdir -p artifacts/$target
for target in "${targets[@]}"; do echo "Building target ${target}..."
mkdir -p artifacts/$target if [ "${GITHUB_REF##*/}" == "master" ]; then
echo "Building target ${target}..." echo "Building safe"
if [ "${GITHUB_REF##*/}" == "master" ]; then zig build -Dtarget=${target} -Drelease-safe --prefix artifacts/${target}/
echo "Building safe" else
zig build -Dtarget=${target} -Drelease-safe --prefix artifacts/${target}/ echo "Building debug as action is not running on master"
else zig build -Dtarget=${target} --prefix artifacts/${target}/
echo "Building debug as action is not running on master" fi
zig build -Dtarget=${target} --prefix artifacts/${target}/ sed -e '1,5d' < README.md > artifacts/${target}/README.md
fi cp LICENSE artifacts/${target}/
sed -e '1,5d' < README.md > artifacts/${target}/README.md done
cp LICENSE artifacts/${target}/
done - name: Upload x86_64-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload x86_64-windows artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-x86_64-windows
with: path: artifacts/x86_64-windows/
name: zls-x86_64-windows
path: artifacts/x86_64-windows/ - name: Upload x86_64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload x86_64-linux artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-x86_64-linux
with: path: artifacts/x86_64-linux/
name: zls-x86_64-linux
path: artifacts/x86_64-linux/ - name: Upload x86_64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload x86_64-macos artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-x86_64-macos
with: path: artifacts/x86_64-macos/
name: zls-x86_64-macos
path: artifacts/x86_64-macos/ - name: Upload x86-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload x86-windows artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-x86-windows
with: path: artifacts/x86-windows/
name: zls-x86-windows
path: artifacts/x86-windows/ - name: Upload x86-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload x86-linux artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-x86-linux
with: path: artifacts/x86-linux/
name: zls-x86-linux
path: artifacts/x86-linux/ - name: Upload aarch64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload aarch64-linux artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-aarch64-linux
with: path: artifacts/aarch64-linux/
name: zls-aarch64-linux
path: artifacts/aarch64-linux/ - name: Upload aarch64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Upload aarch64-macos artifact uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' }} with:
uses: actions/upload-artifact@v3 name: zls-aarch64-macos
with: path: artifacts/aarch64-macos/
name: zls-aarch64-macos
path: artifacts/aarch64-macos/ - name: Beam to Felix
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && github.repository_owner == 'zigtools' }}
- name: Beam to Felix uses: easingthemes/ssh-deploy@v2.1.1
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && github.repository_owner == 'zigtools' }} env:
uses: easingthemes/ssh-deploy@v2.1.1 SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVKEY }}
env: ARGS: "-rltgoDzvO --delete"
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVKEY }} SOURCE: "artifacts/"
ARGS: "-rltgoDzvO --delete" REMOTE_HOST: ${{ secrets.WEBSITE_DEPLOY_HOST }}
SOURCE: "artifacts/" REMOTE_USER: ${{ secrets.WEBSITE_DEPLOY_USER }}
REMOTE_HOST: ${{ secrets.WEBSITE_DEPLOY_HOST }} TARGET: ${{ secrets.WEBSITE_DEPLOY_FOLDER }}
REMOTE_USER: ${{ secrets.WEBSITE_DEPLOY_USER }}
TARGET: ${{ secrets.WEBSITE_DEPLOY_FOLDER }}
- name: Install Nix
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: cachix/install-nix-action@v18
- name: Install Cachix
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: cachix/cachix-action@v12
with:
name: zigtools
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build Nix flake package
if: ${{ matrix.os == 'ubuntu-latest' }}
run: nix build --print-build-logs

View File

@ -1,6 +1,21 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@ -95,9 +110,7 @@
}, },
"zig-overlay": { "zig-overlay": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": "flake-utils_2",
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]

View File

@ -4,7 +4,6 @@
zig-overlay.url = "github:mitchellh/zig-overlay"; zig-overlay.url = "github:mitchellh/zig-overlay";
zig-overlay.inputs.nixpkgs.follows = "nixpkgs"; zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
zig-overlay.inputs.flake-utils.follows = "flake-utils";
gitignore.url = "github:hercules-ci/gitignore.nix"; gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs"; gitignore.inputs.nixpkgs.follows = "nixpkgs";