netty-incubator-buffer-api/.github/workflows/ci-workflow.yml
Chris Vest e3c7f9b632 Capture build artifacts for failed builds
Motivation:
When a build fails, it's desirable to have the build artifacts available
so the build failure can be inspected, investigated and hopefully fixed.

Modification:
Change the Makefile and CI workflow such that the build artifacts are
captured and uploaded when the build fails.

Result:
A "target.zip" file is now available for download on failed GitHub
Actions builds.
2020-12-01 14:38:09 +01:00

52 lines
1.5 KiB
YAML

name: CI Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '30 6 * * 1' # At 06:30 on Monday, every Monday.
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# http://man7.org/linux/man-pages/man1/date.1.html
- name: Create Cache Key
id: cache-key
run: |
echo "::set-output name=key::$(/bin/date -u "+%Y%U")"
shell: bash
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
with:
key: docker-cache-${{ steps.cache-key.outputs.key }}-{hash}
restore-keys: |
docker-cache-${{ steps.cache-key.outputs.key }}-
# Run the make script
- name: Make build
run: make build
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: target
path: target/ # or path/to/artifact