Refactor github actions
Reason: https://github.com/NordicPlayground/nrf-docker/pull/75
This commit is contained in:
parent
35618227d5
commit
141071a414
5 changed files with 40 additions and 59 deletions
5
.github/actions/build/Dockerfile
vendored
5
.github/actions/build/Dockerfile
vendored
|
|
@ -1,5 +0,0 @@
|
|||
FROM nordicplayground/nrfconnect-sdk:v2.4-branch
|
||||
|
||||
COPY build.sh /build.sh
|
||||
|
||||
ENTRYPOINT ["/build.sh"]
|
||||
41
.github/actions/build/action.yml
vendored
41
.github/actions/build/action.yml
vendored
|
|
@ -1,27 +1,34 @@
|
|||
name: 'Build'
|
||||
description: 'Builds a nrf-connect sample for b-parasite'
|
||||
name: "Build"
|
||||
description: "Builds a nrf-connect sample for b-parasite"
|
||||
inputs:
|
||||
sample-dir:
|
||||
description: 'Sample directory to build'
|
||||
description: "Sample directory to build"
|
||||
required: true
|
||||
board:
|
||||
description: 'Board definition to use'
|
||||
description: "Board definition to use"
|
||||
default: bparasite_nrf52840
|
||||
revision:
|
||||
description: 'Board revision use'
|
||||
default: '1.2.0'
|
||||
description: "Board revision use"
|
||||
default: "2.0.0"
|
||||
cmake-extra:
|
||||
description: 'Extra CMake arguments'
|
||||
default: ''
|
||||
description: "Extra CMake arguments"
|
||||
default: ""
|
||||
output-bin:
|
||||
description: 'Name of the .hex output'
|
||||
description: "Name of the .hex output"
|
||||
required: true
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.sample-dir }}
|
||||
- ${{ inputs.board }}
|
||||
- ${{ inputs.revision }}
|
||||
- ${{ inputs.cmake-extra }}
|
||||
- ${{ inputs.output-bin }}
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
docker run --rm -v ${GITHUB_WORKSPACE}:/repo \
|
||||
nordicplayground/nrfconnect-sdk:v2.4-branch \
|
||||
west build \
|
||||
--build-dir /repo/${{ inputs.sample-dir }}/build \
|
||||
--pristine \
|
||||
--board ${{ inputs.board }}@${{ inputs.revision }} \
|
||||
/repo/${{ inputs.sample-dir }} -- ${{ inputs.cmake-extra }}
|
||||
shell: bash
|
||||
- run: |
|
||||
cp "${GITHUB_WORKSPACE}"/${{ inputs.sample-dir }}/build/zephyr/zephyr.hex \
|
||||
"${GITHUB_WORKSPACE}"/${{ inputs.sample-dir }}/build/zephyr/${{ inputs.output-bin }}
|
||||
shell: bash
|
||||
|
|
|
|||
21
.github/actions/build/build.sh
vendored
21
.github/actions/build/build.sh
vendored
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -eux -o pipefail
|
||||
|
||||
SAMPLE_DIR=$1
|
||||
BOARD=$2
|
||||
REVISION=$3
|
||||
CMAKE_EXTRA=$4
|
||||
OUTPUT_BIN=$5
|
||||
|
||||
TODAY=$(date +'%Y-%m-%d')
|
||||
|
||||
# Replaces occurrences of "__TODAY__" with $TODAY in $CMAKE_EXTRA.
|
||||
CMAKE_EXTRA="${CMAKE_EXTRA/__TODAY__/"$TODAY"}"
|
||||
|
||||
cd "${GITHUB_WORKSPACE}/${SAMPLE_DIR}"
|
||||
|
||||
echo $CMAKE_EXTRA
|
||||
|
||||
west build --build-dir ./build --pristine --board "${BOARD}@${REVISION}" -- $CMAKE_EXTRA
|
||||
|
||||
mv build/zephyr/zephyr.hex build/zephyr/"${OUTPUT_BIN}"
|
||||
18
.github/actions/build_and_upload/action.yml
vendored
18
.github/actions/build_and_upload/action.yml
vendored
|
|
@ -1,20 +1,20 @@
|
|||
name: 'Build and upload artifact'
|
||||
description: 'Builds a nrf-connect sample for b-parasite'
|
||||
name: "Build and upload artifact"
|
||||
description: "Builds a nrf-connect sample for b-parasite"
|
||||
inputs:
|
||||
sample-dir:
|
||||
description: 'Sample directory to build'
|
||||
description: "Sample directory to build"
|
||||
required: true
|
||||
board:
|
||||
description: 'Board definition to use'
|
||||
description: "Board definition to use"
|
||||
required: true
|
||||
revision:
|
||||
description: 'Board revision use'
|
||||
default: '1.2.0'
|
||||
description: "Board revision use"
|
||||
default: "2.0.0"
|
||||
cmake-extra:
|
||||
description: 'Extra CMake arguments'
|
||||
default: ''
|
||||
description: "Extra CMake arguments"
|
||||
default: ""
|
||||
output-bin:
|
||||
description: 'Name of the .hex output'
|
||||
description: "Name of the .hex output"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
|
|
|
|||
12
.github/workflows/b-parasite.yml
vendored
12
.github/workflows/b-parasite.yml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- name: Check clang-format
|
||||
uses: jidicula/clang-format-action@v4.9.0
|
||||
with:
|
||||
check-path: 'code/nrf-connect'
|
||||
check-path: "code/nrf-connect"
|
||||
exclude-regex: '\/build\/'
|
||||
|
||||
build-blinky:
|
||||
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
- lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Build blinky
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
- lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Build input
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
|
|
@ -59,7 +59,7 @@ jobs:
|
|||
- lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Build soil_read_loop
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
|
|
@ -79,7 +79,7 @@ jobs:
|
|||
- lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Build
|
||||
uses: ./.github/actions/build_and_upload
|
||||
with:
|
||||
|
|
@ -100,7 +100,7 @@ jobs:
|
|||
- lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Build
|
||||
uses: ./.github/actions/build_and_upload
|
||||
with:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue