Skip to content

Commit

Permalink
ci: port over check.yml to CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 committed Jan 31, 2025
1 parent 221ffbc commit 60765c1
Showing 1 changed file with 100 additions and 21 deletions.
121 changes: 100 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,110 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
jobs:
say-hello:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
executors:
linux-executor:
docker:
- image: ubuntu:latest
python-executor:
docker:
# Specify the version you desire here
# See: https://circleci.com/developer/images/image/cimg/base
- image: cimg/base:current
- image: cimg/python:3.10
macos-executor:
macos:
xcode: 15.4.0
resource_class: m2pro.medium

# Add steps to the job
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
jobs:
setup_zig:
parameters:
target:
type: string
executor: linux-executor
steps:
- checkout
- run:
name: Download Zig
command: |
apt update && apt install -y wget unzip xz-utils
wget https://ziglang.org/download/0.13.0/zig-<< parameters.target >>-0.13.0.tar.xz
tar xf zig-<< parameters.target >>-0.13.0.tar.xz
- persist_to_workspace:
root: zig-<< parameters.target >>-0.13.0
paths:
- '*'

lint:
executor: linux-executor
steps:
- checkout
- attach_workspace:
at: zig-linux-x86_64-0.13.0
- run:
name: Lint
command: zig-linux-x86_64-0.13.0/zig fmt --check src/ build.zig

check_style:
executor: python-executor
steps:
# Checkout the code as the first step.
- checkout
- run:
name: "Say hello"
command: "echo Hello, World!"
name: Install dependencies
command: pip install --upgrade pip
- run:
name: Check style
command: python scripts/style.py --check src

build_linux:
executor: linux-executor
steps:
- checkout
- attach_workspace:
at: zig-linux-x86_64-0.13.0
- restore_cache:
key: linux-x86_64-0.13.0-{{ checksum "build.zig.zon" }}
- run:
name: Build
command: |
export PATH="$PWD/zig-linux-x86_64-0.13.0:$PATH"
zig build -Denable-tsan=true -Dno-run
- save_cache:
key: linux-x86_64-0.13.0-{{ checksum "build.zig.zon" }}
paths:
- .zig-cache
- ~/.cache/zig
- persist_to_workspace:
root: zig-out
paths:
- "bin/test"

# Orchestrate jobs using workflows
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
# build_linux_hashmap:
# executor: linux-executor
# steps:
# - checkout
# - attach_workspace:
# at: zig-linux-x86_64-0.13.0
# - run:
# name: Build
# command: |
# export PATH="$PWD/zig-linux-x86_64-0.13.0:$PATH"
# zig build -Denable-tsan=true -Dno-run

workflows:
say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
check:
jobs:
- say-hello
- check_style
- setup_zig:
target: "linux-x86_64"
- lint:
requires:
- setup_zig
- build_linux:
requires:
- setup_zig

# check_macos:
# jobs:
# - setup_zig:
# target: "macos-aarch64"
# - build_macos:
# requires:
# - setup_zig

0 comments on commit 60765c1

Please sign in to comment.