diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d95fa98b..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: 2 -jobs: - build: - parallelism: 4 - shell: /bin/bash --login - docker: - - image: ericfreese/zsh-autosuggestions-test:latest - steps: - - checkout - - run: - name: Running tests - command: | - for v in $(grep "^[^#]" ZSH_VERSIONS | awk "(NR + $CIRCLE_NODE_INDEX) % $CIRCLE_NODE_TOTAL == 0"); do - TEST_ZSH_BIN=zsh-$v make test || exit 1 - done diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..9171b324 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,50 @@ +on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +env: + IMAGE_CACHE_PATH: /tmp/.image-cache + IMAGE_CACHE_NAME: zsh-autosuggestions-test +jobs: + # Load the ZSH_VERSIONS file as a JSON array to use as a matrix + # See https://stackoverflow.com/a/62953566/154703 + determine-versions: + runs-on: ubuntu-22.04 + outputs: + versions: ${{ steps.versions.outputs.versions }} + steps: + - uses: actions/checkout@v3 + - id: versions + run: | + echo "versions=$( + grep "^[^#]" ZSH_VERSIONS \ + | sed -E 's/(^|$)/"/g' \ + | paste -sd ',' - \ + | sed -e 's/^/[/' -e 's/$/]/' + )" >> $GITHUB_OUTPUT + test: + needs: determine-versions + runs-on: ubuntu-22.04 + strategy: + matrix: + version: ${{ fromJson(needs.determine-versions.outputs.versions) }} + steps: + - uses: actions/checkout@v3 + - id: image-cache + uses: actions/cache@v3 + with: + path: ${{ env.IMAGE_CACHE_PATH }} + key: image-cache-${{ hashFiles('Dockerfile', 'ZSH_VERSIONS') }} + - if: steps.image-cache.outputs.cache-hit + run: gunzip < $IMAGE_CACHE_PATH/$IMAGE_CACHE_NAME.tar.gz | docker load + - if: !steps.image-cache.outputs.cache-hit + run: docker build -t $IMAGE_CACHE_NAME . + - run: | + docker run -it --rm \ + -e TEST_ZSH_BIN=zsh-${{ matrix.version }} \ + -v $PWD:/zsh-autosuggestions $IMAGE_CACHE_NAME \ + make test + - if: !steps.image-cache.outputs.cache-hit + run: | + mkdir -p $IMAGE_CACHE_PATH + docker save $IMAGE_CACHE_NAME | gzip > $IMAGE_CACHE_PATH/$IMAGE_CACHE_NAME.tar.gz