Merge branch 'update-action' #80
This file contains 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: Test action and script | |
on: [ push ] | |
env: | |
DOCKER_BUILDKIT: 1 | |
SHOW_SKIPPED: 1 | |
jobs: | |
tests-standalone: | |
strategy: | |
matrix: | |
target: [ master, 478faddd4a1471a574573d556491d8b14a2f2f5c ] | |
src-ok: [ testdata, test/data1, 5d839740ac4bcc3de80980b5f6447ec1cfbf3832 ] | |
include: | |
- src-ok: testdata | |
src-err: testdata2 | |
- src-ok: test/data1 | |
src-err: test/data2 | |
- src-ok: 5d839740ac4bcc3de80980b5f6447ec1cfbf3832 | |
src-err: d0c66c69a10caa195b4b46b0d95e48c0348a2e74 | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
path: .test | |
- name: Build the image | |
run: docker build .test --tag ghcr.io/wolletd/clang-format:latest | |
- name: test with no error | |
uses: ./.test/ | |
with: | |
source-ref: ${{ matrix.src-ok }} | |
target-ref: ${{ matrix.target }} | |
- name: clear git repo | |
run: git rm -rf . && rm -rf .git | |
- name: test json is skipped | |
uses: ./.test/ | |
with: | |
source-ref: ${{ matrix.src-ok }} | |
target-ref: ${{ matrix.target }} | |
clang-version: 12 | |
- name: clear git repo | |
run: git rm -rf . && rm -rf .git | |
- name: test without source-ref (does nothing in this case, but should succeed) | |
uses: ./.test/ | |
with: | |
target-ref: ${{ matrix.target }} | |
- name: clear git repo | |
run: git rm -rf . && rm -rf .git | |
- name: test with format error | |
uses: ./.test/ | |
with: | |
source-ref: ${{ matrix.src-err }} | |
target-ref: ${{ matrix.target }} | |
continue-on-error: true | |
id: fail1 | |
- name: clear git repo | |
run: git rm -rf . && rm -rf .git | |
- name: test with git error | |
uses: ./.test/ | |
with: | |
source-ref: ${{ matrix.src-ok }} | |
target-ref: nonexistent | |
continue-on-error: true | |
id: fail2 | |
- name: check for expected failures | |
if: steps.fail1.outcome == 'success' || steps.fail2.outcome == 'success' | |
run: exit 1 | |
tests-checkout: | |
strategy: | |
matrix: | |
target: [ master, 478faddd4a1471a574573d556491d8b14a2f2f5c ] | |
src-ok: [ testdata, test/data1, 5d839740ac4bcc3de80980b5f6447ec1cfbf3832 ] | |
include: | |
- src-ok: testdata | |
src-err: testdata2 | |
- src-ok: test/data1 | |
src-err: test/data2 | |
- src-ok: 5d839740ac4bcc3de80980b5f6447ec1cfbf3832 | |
src-err: d0c66c69a10caa195b4b46b0d95e48c0348a2e74 | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout ${{ matrix.src-ok }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.src-ok }} | |
- name: checkout ref to test | |
uses: actions/checkout@v4 | |
with: | |
path: .test | |
- name: Build the image | |
run: docker build .test --tag ghcr.io/wolletd/clang-format:latest | |
- name: test with no error | |
uses: ./.test/ | |
with: | |
target-ref: ${{ matrix.target }} | |
- name: test json is skipped | |
uses: ./.test/ | |
with: | |
target-ref: ${{ matrix.target }} | |
clang-version: 12 | |
- name: test with git error | |
uses: ./.test/ | |
with: | |
target-ref: nonexistent | |
continue-on-error: true | |
id: fail2 | |
- name: checkout ${{ matrix.src-err }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.src-err }} | |
clean: false | |
- name: test with format error | |
uses: ./.test/ | |
with: | |
target-ref: ${{ matrix.target }} | |
continue-on-error: true | |
id: fail1 | |
- name: check for expected failures | |
if: steps.fail1.outcome == 'success' || steps.fail2.outcome == 'success' | |
run: exit 1 | |
tests-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Build the image | |
run: docker build . --tag ghcr.io/wolletd/clang-format:latest | |
- name: fetch required refs | |
run: git fetch --depth=50 origin master:target tag testdata tag testdata2 | |
- name: test with no error | |
run: ./clang-format-checker target testdata | |
- name: test json is skipped | |
run: ./clang-format-checker -v12 target testdata | |
- name: test with git error | |
run: '! ./clang-format-checker nonexistent testdata' | |
- name: test with format error | |
run: '! ./clang-format-checker target testdata2' |