Skip to content

Build and Cache

Build and Cache #1676

Workflow file for this run

name: "Build and Cache"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
workflow_run:
workflows: ["Check for Updates"]
types:
- completed
branches: [ main ]
jobs:
build:
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
variant: [codex, codex-node]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
env:
NIX_FIRST_BUILD_UID: 400
- uses: cachix/cachix-action@v15
if: github.ref == 'refs/heads/main'
with:
name: codex-cli
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build ${{ matrix.variant }}
run: |
nix build .#${{ matrix.variant }}
- name: Push to Cachix
if: github.ref == 'refs/heads/main'
run: |
nix build .#${{ matrix.variant }} --json | jq -r '.[].outputs.out' | cachix push codex-cli
- name: Test ${{ matrix.variant }}
run: |
case "${{ matrix.variant }}" in
codex)
./result/bin/codex --version
;;
codex-node)
./result/bin/codex-node --version
;;
esac