Skip to content

Commit

Permalink
ci: do not rerun jobs that did not fail when retrying jobs on github …
Browse files Browse the repository at this point in the history
…actions [skip circle] [skip appveyor]
  • Loading branch information
JCMais committed Nov 29, 2021
1 parent f337f66 commit 3b52cb4
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 13 deletions.
48 changes: 45 additions & 3 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
NODE_LIBCURL_CPP_STD: c++11
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- name: Checkout
uses: actions/checkout@main
- name: Setup Node.js
Expand Down Expand Up @@ -109,15 +121,17 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
if: steps.run_result.outputs.run_result != 'success'
run: |
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result

build-and-release-electron:
runs-on: ${{ matrix.os }}
Expand All @@ -144,6 +158,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
ELECTRON_VERSION: ${{ matrix.electron-version }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@main
Expand Down Expand Up @@ -198,15 +224,17 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
if: steps.run_result.outputs.run_result != 'success'
run: |
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result

build-and-release-nwjs:
runs-on: ${{ matrix.os }}
Expand All @@ -231,6 +259,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
NWJS_VERSION: ${{ matrix.nwjs-version }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@main
Expand Down Expand Up @@ -277,12 +317,14 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
if: steps.run_result.outputs.run_result != 'success'
run: |
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result
64 changes: 54 additions & 10 deletions .github/workflows/build-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
NODE_LIBCURL_CPP_STD: c++11
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- name: Checkout
uses: actions/checkout@main
- name: Setup Node.js
Expand Down Expand Up @@ -99,35 +111,39 @@ jobs:
key: v4-build-lint-test-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
restore-keys: |
v4-build-lint-test-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
- name: 'Install all the stuff'
- name: 'Build node-libcurl'
if: steps.run_result.outputs.run_result != 'success'
run: |
RUN_TESTS=false \
RUN_PREGYP_CLEAN=false \
PUBLISH_BINARY=false \
./scripts/ci/build.sh
# We could have used lerna to run only on changed here...
- name: 'Run lint'
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
run: yarn lint
if: matrix.run-lint-and-tsc
- name: 'Run tsc'
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
run: yarn build:dist
if: matrix.run-lint-and-tsc
# we do run tests in all matrix jobs
- name: 'Run tests'
if: steps.run_result.outputs.run_result != 'success'
run: yarn test:coverage
# but coverage is only sent for the run-lint-and-tsc job
- name: Upload coverage to Codecov
if: matrix.run-lint-and-tsc
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/**
fail_ci_if_error: false
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
path: ./logs/
retention-days: 3
- run: echo "::set-output name=run_result::success" > run_result

build-and-test-electron:
runs-on: ${{ matrix.os }}
Expand All @@ -154,6 +170,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
ELECTRON_VERSION: ${{ matrix.electron-version }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
if: matrix.node-libcurl-cpp-std
- name: Checkout
Expand Down Expand Up @@ -208,19 +236,21 @@ jobs:
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
- name: 'Build node-libcurl'
if: steps.run_result.outputs.run_result != 'success'
run: |
RUN_TESTS=true \
RUN_PREGYP_CLEAN=false \
PUBLISH_BINARY=false \
./scripts/ci/build.sh
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result

build-and-test-nwjs:
runs-on: ${{ matrix.os }}
Expand All @@ -245,6 +275,18 @@ jobs:
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
NWJS_VERSION: ${{ matrix.nwjs-version }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v2
with:
path: |
run_result
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@main
Expand Down Expand Up @@ -290,16 +332,18 @@ jobs:
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
- name: 'Build node-libcurl'
if: steps.run_result.outputs.run_result != 'success'
run: |
RUN_TESTS=false \
RUN_PREGYP_CLEAN=false \
PUBLISH_BINARY=false \
./scripts/ci/build.sh
- name: Upload artifacts
if: always()
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v2
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result

0 comments on commit 3b52cb4

Please sign in to comment.