From 45e128e76994a5bc36d65a081e27b01aa5f2597f Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 7 Feb 2022 18:19:51 -0800 Subject: [PATCH 1/2] Refactor tests to use a matrix --- .github/workflows/test.yml | 213 ++++--------------------------------- 1 file changed, 19 insertions(+), 194 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4d8cdd..ec208fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,14 @@ -name: 'Test' +name: "Test" on: push: branches: - main paths-ignore: - - 'README.md' + - "README.md" pull_request: paths-ignore: - - 'README.md' + - "README.md" env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io @@ -34,11 +34,20 @@ jobs: text: ${{ steps.grep-image-content.outputs.image }} regex: "jekyll-build-pages:(.*)'" - test-simple: + test-builds: needs: resolve-image-tag runs-on: ubuntu-latest - env: - TEST_NAME: simple + strategy: + matrix: + test: + - simple + - readme + - octicons + - mojombo + - themes + - jekyll-include-cache + - future-false + - future-true steps: - name: Checkout repository uses: actions/checkout@v2 @@ -48,198 +57,14 @@ jobs: context: . file: Dockerfile tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project + - name: Test ${{ matrix.name }} Project uses: ./ with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site + source: ./test_projects/${{ matrix.name }} + destination: ./test_projects/${{ matrix.name }}/_site build_revision: JEKYLL_BUILD_REVISION token: ${{ secrets.GITHUB_TOKEN }} - name: Verify output run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-readme: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: readme - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-octicons: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: octicons - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-mojombo: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: mojombo - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-themes: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: themes - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-jekyll-include-cache: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: jekyll-include-cache - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-future-false: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: future-false - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} - - test-future-true: - needs: resolve-image-tag - runs-on: ubuntu-latest - env: - TEST_NAME: future-true - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Build local docker image - uses: docker/build-push-action@v2 - with: - context: . - file: Dockerfile - tags: ${{ needs.resolve-image-tag.outputs.tag }} - - - name: Test ${{ env.TEST_NAME }} Project - uses: ./ - with: - source: ./test_projects/${{ env.TEST_NAME }} - destination: ./test_projects/${{ env.TEST_NAME }}/_site - build_revision: JEKYLL_BUILD_REVISION - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Verify output - run: | - ./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}} + ./bin/compare_expected_output ./test_projects/${{matrix.name}} From c6b6e3f6a621d6245b6e1f9959ff2339ef0682b4 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 7 Feb 2022 18:23:34 -0800 Subject: [PATCH 2/2] Fix typo --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec208fa..4db70a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,14 +57,14 @@ jobs: context: . file: Dockerfile tags: ${{ needs.resolve-image-tag.outputs.tag }} - - name: Test ${{ matrix.name }} Project + - name: Test ${{ matrix.test }} Project uses: ./ with: - source: ./test_projects/${{ matrix.name }} - destination: ./test_projects/${{ matrix.name }}/_site + source: ./test_projects/${{ matrix.test }} + destination: ./test_projects/${{ matrix.test }}/_site build_revision: JEKYLL_BUILD_REVISION token: ${{ secrets.GITHUB_TOKEN }} - name: Verify output run: | - ./bin/compare_expected_output ./test_projects/${{matrix.name}} + ./bin/compare_expected_output ./test_projects/${{matrix.test}}