CI #1609
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
| name: "CI" | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "main" | |
| schedule: | |
| - cron: '20 2 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-javascript: | |
| name: "JavaScript Tests" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| os: | |
| - "ubuntu-latest" | |
| - "ubuntu-slim" | |
| - "macos-latest" | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: "Install Flox" | |
| uses: "./" | |
| with: | |
| disable-metrics: true | |
| - name: "Cache Dependencies" | |
| id: cache | |
| uses: "actions/cache@8070854e57d983bdd2887b0a708ad985f77398ab" | |
| env: | |
| GITHUB_ACTIONS_RUNNER_FORCED_NODE_VERSION: node20 | |
| with: | |
| key: npm-${{ matrix.os }}-${{ hashFiles('package-lock.json') }} | |
| path: ./node_modules | |
| restore-keys: | | |
| npm-feature-${{ matrix.os }}-${{ hashFiles('package-lock.json') }} | |
| npm-feature-${{ matrix.os }}- | |
| npm-feature- | |
| npm- | |
| - name: "Install Dependencies" | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: flox activate -- npm ci | |
| - name: "Check Format" | |
| run: flox activate -- npm run format:check | |
| - name: "Test" | |
| run: flox activate -- npm run ci-test | |
| test-action: | |
| name: "Github Action Test" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| os: | |
| - "ubuntu-latest" | |
| - "ubuntu-slim" | |
| - "macos-latest" | |
| release-env: | |
| - stable | |
| - nightly | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: "Test Local Action" | |
| uses: "./" | |
| with: | |
| channel: "${{ matrix.release-env }}" | |
| disable-metrics: true | |
| - name: "Test: flox" | |
| run: | | |
| flox --version | |
| cd $(mktemp -d) | |
| flox init | |
| flox install hello | |
| flox activate -- hello | |
| - name: "Test: flox config" | |
| run: | | |
| export disable_metrics_value="$(flox config --list | grep 'disable_metrics' | cut -d' ' -f3)" | |
| if [[ "$disable_metrics_value" != "true" ]]; then | |
| echo "Expected 'disable_metrics' to be 'true' but got '$disable_metrics_value'" | |
| exit 1 | |
| fi | |
| test-new-inputs: | |
| name: "Test New Inputs" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| os: | |
| - "ubuntu-latest" | |
| - "ubuntu-slim" | |
| - "macos-latest" | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: "Install Flox with new inputs" | |
| id: install | |
| uses: "./" | |
| with: | |
| channel: stable | |
| disable-metrics: "true" | |
| disable-upgrade-notifications: "true" | |
| - name: "Verify outputs" | |
| run: | | |
| echo "Flox version: ${{ steps.install.outputs.flox-version }}" | |
| echo "Flox path: ${{ steps.install.outputs.flox-path }}" | |
| echo "Nix detected: ${{ steps.install.outputs.nix-detected }}" | |
| test -n "${{ steps.install.outputs.flox-version }}" | |
| test -n "${{ steps.install.outputs.flox-path }}" | |
| - name: "Verify config" | |
| run: | | |
| flox config --list | grep -q 'disable_metrics = true' | |
| flox config --list | grep -q 'upgrade_notifications = false' | |
| - name: "Test: flox" | |
| run: | | |
| flox --version | |
| cd $(mktemp -d) | |
| flox init | |
| flox install hello | |
| flox activate -- hello | |
| test-existing-nix: | |
| name: "Test with Existing Nix (${{ matrix.nix-installer }})" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - "ubuntu-latest" | |
| - "ubuntu-slim" | |
| - "macos-latest" | |
| nix-installer: | |
| - "determinate-systems" | |
| - "cachix" | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: "Install Nix (DeterminateSystems)" | |
| if: matrix.nix-installer == 'determinate-systems' | |
| uses: DeterminateSystems/nix-installer-action@a7ad9c4f0c65208097f4d34f3cfa1913b80cce5c # main | |
| - name: "Install Nix (Cachix)" | |
| if: matrix.nix-installer == 'cachix' | |
| uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31 | |
| - name: "Install Flox (using existing Nix)" | |
| uses: "./" | |
| with: | |
| disable-metrics: true | |
| - name: "Test: flox" | |
| run: | | |
| flox --version | |
| cd $(mktemp -d) | |
| flox init | |
| flox install hello | |
| flox activate -- hello | |
| - name: "Test: flox config" | |
| run: | | |
| export disable_metrics_value="$(flox config --list | grep 'disable_metrics' | cut -d' ' -f3)" | |
| if [[ "$disable_metrics_value" != "true" ]]; then | |
| echo "Expected 'disable_metrics' to be 'true' but got '$disable_metrics_value'" | |
| exit 1 | |
| fi | |
| test-act: | |
| name: "Test with nektos/act" | |
| runs-on: "ubuntu-latest" | |
| timeout-minutes: 30 | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: "Install act" | |
| run: >- | |
| curl | |
| https://raw.githubusercontent.com/nektos/act/master/install.sh | |
| | sudo bash | |
| - name: "Pull container image" | |
| run: >- | |
| docker pull | |
| ghcr.io/catthehacker/ubuntu:js-24.04 | |
| - name: "Run action with act" | |
| run: >- | |
| ./bin/act push | |
| -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-24.04 | |
| -j test-action | |
| --matrix os:ubuntu-latest | |
| --matrix release-env:stable | |
| --env FLOX_DISABLE_METRICS=true | |
| report-failure: | |
| name: "Report Failure" | |
| runs-on: "ubuntu-slim" | |
| timeout-minutes: 30 | |
| if: ${{ failure() && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') }} | |
| needs: | |
| - "test-javascript" | |
| - "test-action" | |
| - "test-new-inputs" | |
| - "test-existing-nix" | |
| - "test-act" | |
| steps: | |
| - name: "Slack Notification" | |
| uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2 | |
| env: | |
| SLACK_TITLE: "Something broke CI for flox/flox on main" | |
| SLACK_FOOTER: "Thank you for caring" | |
| SLACK_WEBHOOK: "${{ secrets.MANAGED_SLACK_WEBHOOK }}" | |
| SLACK_USERNAME: "GitHub" | |
| SLACK_ICON_EMOJI: ":poop:" | |
| SLACK_COLOR: "#ff2800" # ferrari red -> https://encycolorpedia.com/ff2800 | |
| SLACK_LINK_NAMES: true |