Fix ros-free build (with-ros=false) #71
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: "CI - Nix - Private" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| populate-cache: | |
| # - This condition allows the job to run if: | |
| # - The workflow is not triggered by a pull request (`github.event_name != 'pull_request'`), or | |
| # - The PR's source repo is the same as the base repo. | |
| # This is done to make sure that the required secrets are available to the CI | |
| if: github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name | |
| name: "${{matrix.variant}}: ${{ matrix.build }} on ${{ matrix.os }}" | |
| runs-on: "${{ matrix.os }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: &matrix | |
| os: [ubuntu-24.04] | |
| variant: | |
| - "private" | |
| - "private-ccache" | |
| build: | |
| - "devShells.x86_64-linux.mc-rtc-superbuild-minimal" | |
| - "devShells.x86_64-linux.mc-rtc-superbuild-default" | |
| - "devShells.x86_64-linux.mc-rtc-superbuild-default-all-robots" | |
| - "devShells.x86_64-linux.mc-rtc-superbuild-full" | |
| 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: 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.variant == 'private-ccache' }} | |
| 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: | |
| 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: 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) }} | |