From 51930bb5be9a4b40aefb08e51b69b6d26f636f1b Mon Sep 17 00:00:00 2001 From: afsmi Date: Fri, 16 Oct 2020 09:37:29 -0700 Subject: [PATCH 1/4] add opt-out and opt-in options to ci using labels --- .github/workflows/testing_changes.yml | 35 +++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing_changes.yml b/.github/workflows/testing_changes.yml index 4695ae8..497fbb4 100644 --- a/.github/workflows/testing_changes.yml +++ b/.github/workflows/testing_changes.yml @@ -12,14 +12,45 @@ # - cargo tarpaulin does not work on macos # - cargo test fails with linking on macos -on: [push, pull_request] +on: + push: + paths-ignore: + - '.github/workflows/**' + pull_request: + types: [opened,reopened,synchronize,ready_for_review,labeled] name: testing_changes jobs: + run-guard: + # other jobs depend on this one using 'needs: run-guard' to avoid running when it is skipped. + # it succeeds if any of the following conditions are met: + # - it is not a pr-labeling event AND the pr is not labeled 'prevent-ci' AND it is not a draft pr + # - it is not a pr-labeling event AND the pr is labeled 'force-ci' + # - it is a pr-labeling event AND the label being added is 'force-ci' + # + # on success it dumps the action's 'github' context + runs-on: ubuntu-latest + name: 'run-guard' + if: | + ( + (github.event.action != 'labeled') + && !contains( github.event.pull_request.labels.*.name, 'prevent-ci') + && !github.event.pull_request.draft + ) + || ( (github.event.action != 'labeled') && contains( github.event.pull_request.labels.*.name, 'force-ci' ) ) + || (github.event.label.name == 'force-ci') + steps: + #helpful for debugging event + - name: dump action context 'github' + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + linting: name: linting runs-on: ubuntu-latest + needs: run-guard steps: - name: Checkout sources uses: actions/checkout@v2 @@ -56,6 +87,7 @@ jobs: name: testing strategy: fail-fast: false + needs: linting matrix: os: ["ubuntu-20.04", "windows-latest", "macos-latest"] firebird: [v3, v2, v4] @@ -89,7 +121,6 @@ jobs: - build: pure_rust features: pure_rust date_time pool runs-on: "${{ matrix.os }}" - needs: linting steps: - name: Setup FirebirdSQL ${{ matrix.firebird }} with image ${{ matrix.image }} on docker if: matrix.plataform == 'linux' From 9ac199723ef2bfa5fa889140965da27221815b02 Mon Sep 17 00:00:00 2001 From: afsmi Date: Fri, 16 Oct 2020 10:10:49 -0700 Subject: [PATCH 2/4] Update testing_changes.yml whoops. I need to be more careful --- .github/workflows/testing_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing_changes.yml b/.github/workflows/testing_changes.yml index 497fbb4..f877344 100644 --- a/.github/workflows/testing_changes.yml +++ b/.github/workflows/testing_changes.yml @@ -85,9 +85,9 @@ jobs: testing: name: testing + needs: linting strategy: fail-fast: false - needs: linting matrix: os: ["ubuntu-20.04", "windows-latest", "macos-latest"] firebird: [v3, v2, v4] From ae9f80e9ecc32ab395c800ac91d4d96d9c4d711b Mon Sep 17 00:00:00 2001 From: afsmi Date: Fri, 16 Oct 2020 18:19:39 -0700 Subject: [PATCH 3/4] change runguard step to avoid potential leaks --- .github/workflows/testing_changes.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing_changes.yml b/.github/workflows/testing_changes.yml index f877344..b48a05a 100644 --- a/.github/workflows/testing_changes.yml +++ b/.github/workflows/testing_changes.yml @@ -41,11 +41,8 @@ jobs: || ( (github.event.action != 'labeled') && contains( github.event.pull_request.labels.*.name, 'force-ci' ) ) || (github.event.label.name == 'force-ci') steps: - #helpful for debugging event - - name: dump action context 'github' - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" + - name: continue + run: echo not skipping CI. continuing now... linting: name: linting @@ -85,9 +82,9 @@ jobs: testing: name: testing - needs: linting strategy: fail-fast: false + needs: linting matrix: os: ["ubuntu-20.04", "windows-latest", "macos-latest"] firebird: [v3, v2, v4] From 977e5ebe1a4b844855dfc0391a6c6837c8170fce Mon Sep 17 00:00:00 2001 From: afsmi Date: Fri, 16 Oct 2020 18:28:24 -0700 Subject: [PATCH 4/4] fixed malplaced needs: line again --- .github/workflows/testing_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing_changes.yml b/.github/workflows/testing_changes.yml index b48a05a..2f90fcc 100644 --- a/.github/workflows/testing_changes.yml +++ b/.github/workflows/testing_changes.yml @@ -82,9 +82,9 @@ jobs: testing: name: testing + needs: linting strategy: fail-fast: false - needs: linting matrix: os: ["ubuntu-20.04", "windows-latest", "macos-latest"] firebird: [v3, v2, v4]