From 48240714ae9d095c5118298248eb06c7f716081a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89douard=20Lopez?= Date: Mon, 5 Feb 2024 15:21:40 +0100 Subject: [PATCH] ci(WIP): fix pure_enable_container_detection --- .github/workflows/ci.yml | 74 +++++++++-------------- .github/workflows/macos.yml | 21 +++++++ .github/workflows/nixos.yml | 19 ++++++ tests/_pure_is_inside_container.test.fish | 8 +++ 4 files changed, 76 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/nixos.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 152cb9c5..08a674fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,53 +23,35 @@ on: - ".github/**/*.yml" jobs: - test-container: - name: Test on fish ${{ matrix.version.fish }} on Docker - runs-on: ubuntu-latest - strategy: - matrix: - version: [ - { fish: 3.3.1, alpine: 3.15 }, # for Ubuntu 22.04 LTS - { fish: 3.6.3, alpine: 3.19 }, - { fish: 3.7.0, alpine: 'edge' }, - # { fish: 3.6.2, alpine: 'edge' }, - ] - steps: - - uses: actions/checkout@v2 - - run: make build-pure-on FISH_VERSION=${{ matrix.version.fish }} - - run: docker --version - - run: make test-pure-on FISH_VERSION=${{ matrix.version.fish }} + # test-container: + # name: Test on fish ${{ matrix.version.fish }} on Docker + # runs-on: ubuntu-latest + # strategy: + # matrix: + # version: [ + # # { fish: 3.3.1, alpine: 3.15 }, # for Ubuntu 22.04 LTS + # # { fish: 3.6.3, alpine: 3.19 }, + # # { fish: 3.7.0, alpine: 'edge' }, + # # { fish: 3.6.2, alpine: 'edge' }, + # ] + # steps: + # - uses: actions/checkout@v2 + # - run: make build-pure-on FISH_VERSION=${{ matrix.version.fish }} + # - run: docker --version + # - run: make test-pure-on FISH_VERSION=${{ matrix.version.fish }} - test-nixos: - name: Test `pure` with Fish ${{ matrix.version.fish }} on NixOS container - runs-on: ubuntu-latest - strategy: - matrix: - version: [ - { fish: 3.7.0, alpine: 'edge' }, # https://search.nixos.org/packages?show=fish&type=packages&query=fish - ] - steps: - - uses: actions/checkout@v2 - - run: make build-pure-on-nix FISH_VERSION=${{ matrix.version.fish }} - - run: docker --version - - run: make test-pure-on-nix FISH_VERSION=${{ matrix.version.fish }} + # test-nixos: + # uses: ./.github/workflows/nixos.yml + # secrets: inherit test-macos: - name: Test on fish on MacOS - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Install Fish - run: brew install fish - - name: Install Fisher > Fishtape > Pure - run: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher jorgebucaran/fishtape ./ - shell: fish {0} - - name: Test Pure - run: fishtape tests/*.test.fish - shell: fish {0} - - bump-version: # Bump when on master - needs: [test-container] - if: contains(github.ref, 'master') - uses: ./.github/workflows/bump-version.yml + if: true + uses: ./.github/workflows/macos.yml secrets: inherit + + + # bump-version: # Bump when on master + # needs: [test-container] + # if: contains(github.ref, 'master') + # uses: ./.github/workflows/bump-version.yml + # secrets: inherit diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..3ef510c0 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,21 @@ +name: Test on MacOS + +on: + workflow_call: + +jobs: + test-macos: + name: Test on fish on MacOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: show os + run: uname -s + - name: Install Fish + run: brew install fish + - name: Install Fisher > Fishtape > Pure + run: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher jorgebucaran/fishtape ./ + shell: fish {0} + - name: Test Pure + run: fishtape tests/*.test.fish + shell: fish {0} diff --git a/.github/workflows/nixos.yml b/.github/workflows/nixos.yml new file mode 100644 index 00000000..c3461d91 --- /dev/null +++ b/.github/workflows/nixos.yml @@ -0,0 +1,19 @@ +name: Test on NixOS + +on: + workflow_call: + +jobs: + test-nixos: + name: Test `pure` with Fish ${{ matrix.version.fish }} on NixOS container + runs-on: ubuntu-latest + strategy: + matrix: + version: [ + { fish: 3.7.0, alpine: 'edge' }, # https://search.nixos.org/packages?show=fish&type=packages&query=fish + ] + steps: + - uses: actions/checkout@v2 + - run: make build-pure-on-nix FISH_VERSION=${{ matrix.version.fish }} + - run: docker --version + - run: make test-pure-on-nix FISH_VERSION=${{ matrix.version.fish }} diff --git a/tests/_pure_is_inside_container.test.fish b/tests/_pure_is_inside_container.test.fish index 0bf88b55..ad9316eb 100644 --- a/tests/_pure_is_inside_container.test.fish +++ b/tests/_pure_is_inside_container.test.fish @@ -53,6 +53,14 @@ end echo $called ) = once +if test (uname -s) != Darwin + @test "_pure_is_inside_container: check `uname -s`" ( + cleanup_spy + + test (uname -s) != Darwin + ) $status -eq $SUCCESS +end + if test (uname -s) != Darwin cleanup_spy @test "_pure_is_inside_container: true for Github Action on Ubuntu" (