MacOS support (no ros, no python bindings) #79
Workflow file for this run
This file contains hidden or 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
| # Build with private overlay and private + ccache overlay | |
| # WARNING: This workflow builds private repositories | |
| # It uses the cachix cache but must NOT push to it | |
| # Instead it must push to the private authenticated attic cache | |
| name: "Nix - Private" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| populate-cache: | |
| #if: github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name | |
| if: false | |
| name: "private-${{ matrix.ccache == true && 'ccache' || 'no-ccache' }}-${{ matrix.ros == true && 'ros' || 'ros-free' }}: ${{ matrix.build }} on ${{ matrix.os }}" | |
| runs-on: "${{ matrix.os }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: &matrix | |
| os: [ubuntu-24.04] | |
| private: [true] # Kept as a matrix item for easy flagging | |
| ccache: [true, false] | |
| ros: [true, false] | |
| build: | |
| - "devShells.x86_64-linux.mc-rtc-superbuild-full" | |
| steps: | |
| - name: "Determine Variant Arguments" | |
| id: flags | |
| run: | | |
| ARGS="" | |
| # Private trigger is always true for this matrix dimension | |
| if [ "${{ matrix.private }}" = "true" ]; then | |
| ARGS="$ARGS --override-input private-trigger github:boolean-option/true" | |
| fi | |
| # Handle ccache trigger | |
| if [ "${{ matrix.ccache }}" = "true" ]; then | |
| ARGS="$ARGS --override-input ccache-trigger github:boolean-option/true" | |
| else | |
| ARGS="$ARGS --override-input ccache-trigger github:boolean-option/false" | |
| fi | |
| # Handle ros trigger | |
| if [ "${{ matrix.ros }}" = "true" ]; then | |
| ARGS="$ARGS --override-input with-ros-trigger github:boolean-option/true" | |
| else | |
| ARGS="$ARGS --override-input with-ros-trigger github:boolean-option/false" | |
| fi | |
| # Trim leading space and export | |
| echo "args=$(echo "$ARGS" | xargs)" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v6 | |
| # Configures ssh-agent if SSH_KEY secret exists | |
| - &confiure-ssh-agent | |
| name: Configure ssh-agent | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - &add-known-hosts | |
| name: Add gite.lirmm.fr to known_hosts | |
| run: | | |
| ssh-keyscan gite.lirmm.fr >> ~/.ssh/known_hosts | |
| - uses: cachix/install-nix-action@v31 | |
| # read-only cache | |
| - &setup-cachix-action | |
| uses: cachix/cachix-action@v17 | |
| with: | |
| name: mc-rtc-nix | |
| extraPullNames: "ros,gepetto" | |
| # will push all paths not already in the public cache | |
| - &setup-private-attic | |
| name: Setup Attic cache (private) | |
| uses: ryanccn/attic-action@v0 | |
| with: | |
| endpoint: https://attic.arntanguy.fr | |
| cache: mc-rtc-nix-private | |
| token: ${{ secrets.ATTIC_TOKEN }} | |
| - &setup-ccache-env | |
| name: Setup ccache environment | |
| if: ${{ matrix.ccache == true }} | |
| run: | | |
| sudo mkdir -m0770 -p '/var/cache/ccache' | |
| sudo chown --reference=/nix/store '/var/cache/ccache' | |
| mkdir -p ~/.config/nix | |
| echo 'extra-sandbox-paths = /var/cache/ccache' | sudo tee -a /etc/nix/nix.conf | |
| sudo systemctl restart nix-daemon.service | |
| sudo ls -ld /var/cache/ccache | |
| - run: nix build -L ${{ steps.flags.outputs.args }} ".#${{ matrix.build }}" --cores 4 | |
| complete: | |
| if: false | |
| needs: populate-cache | |
| name: "complete ${{ matrix.os }}" | |
| runs-on: "${{ matrix.os }}-latest" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu] # TODO: macos | |
| steps: | |
| - uses: jlumbroso/free-disk-space@main | |
| if: ${{ matrix.os == 'ubuntu' }} | |
| - uses: actions/checkout@v6 | |
| - uses: cachix/install-nix-action@v31 | |
| - *setup-cachix-action | |
| - *setup-private-attic | |
| - *setup-ccache-env | |
| - run: nix flake check -L ${{ steps.flags.outputs.args }} | |
| fallback: | |
| needs: complete | |
| if: false | |
| # if: always() && needs.complete.result == 'failure' | |
| name: "fallback ${{matrix.variant}}: ${{ matrix.build }} on ${{ matrix.os }}" | |
| runs-on: "${{ matrix.os }}-latest" | |
| strategy: | |
| fail-fast: false | |
| matrix: *matrix | |
| steps: | |
| - name: "Determine Variant Arguments" | |
| id: flags | |
| run: | | |
| if [ "${{ matrix.variant }}" = "private" ]; then | |
| echo "args=--override-input private-trigger github:boolean-option/true" >> "$GITHUB_OUTPUT" | |
| elif [ "${{ matrix.variant }}" = "private-ccache" ]; then | |
| echo "args=--override-input private-trigger github:boolean-option/true --override-input ccache-trigger github:boolean-option/true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Unsupported variant: ${{ matrix.variant }}" | |
| exit 42 | |
| fi | |
| - uses: jlumbroso/free-disk-space@main | |
| if: ${{ matrix.os == 'ubuntu' }} | |
| - *confiure-ssh-agent | |
| - *add-known-hosts | |
| - uses: actions/checkout@v6 | |
| - uses: cachix/install-nix-action@v31 | |
| - *setup-cachix-action | |
| - *setup-private-attic | |
| - *setup-ccache-env | |
| - run: nix build -L ${{ steps.flags.outputs.args }} ".#${{ matrix.build }}" --cores 1 | |
| check: | |
| if: always() | |
| name: check-macos-linux-nix-private | |
| runs-on: ubuntu-latest | |
| needs: | |
| - fallback | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| allowed-skips: fallback | |
| jobs: ${{ toJSON(needs) }} | |