Skip to content

Commit

Permalink
ci: use composite checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
karhama committed Dec 20, 2023
1 parent 7d98fef commit 5e4d94b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 70 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ jobs:
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Checkout the code
uses: actions/checkout@v3
- name: Checkout sources
uses: karhama/action-checkout@main
with:
path: ncs/nrf
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
git-fetch-depth: 0
git-ref: ${{ github.event.pull_request.head.sha }}

- name: cache-pip
uses: actions/cache@v3
Expand All @@ -34,13 +33,11 @@ jobs:
grep -E "^west" scripts/requirements-fixed.txt | cut -d ' ' -f '1' | xargs pip3 install -U
pip3 show -f west
- name: West init and update
- name: Run merge commits test
env:
BASE_REF: ${{ github.base_ref }}
working-directory: ncs/nrf
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git remote -v
# Ensure there's no merge commits in the PR
[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \
Expand All @@ -49,8 +46,6 @@ jobs:
git rebase origin/${BASE_REF}
# debug
git log --pretty=oneline | head -n 10
west init -l .
west update --narrow -o=--depth=1
- name: Run CODEOWNERS test
id: codeowners
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/create-upmerge-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,21 @@ jobs:
if: github.repository == 'nrfconnect/sdk-nrf'
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Checkout sources
uses: nordicbuilder/action-checkout-west-update@main
with:
path: ncs/nrf
fetch-depth: 0
git-fetch-depth: 0
west-update-args: 'zephyr bsim mcuboot'

- name: Install base dependencies
working-directory: ncs
run: |
pip3 install -r nrf/scripts/requirements-base.txt
pip3 install -r nrf/scripts/requirements-extra.txt
- name: West init and update
- name: Get repo urls
working-directory: ncs
run: |
west init -l nrf
west update zephyr bsim mcuboot
git config --global user.email "noreply@nordicsemi.no"
git config --global user.name "Nordic Builder"
echo "SDK_ZEPHYR=$(west list zephyr -f {url} | awk -F// '{print $NF}')" >> $GITHUB_ENV
echo "SDK_MCUBOOT=$(west list mcuboot -f {url} | awk -F// '{print $NF}')" >> $GITHUB_ENV
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ jobs:
cancel-in-progress: true

steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
path: ncs/nrf
fetch-depth: 0
- name: Checkout sources
uses: nordicbuilder/action-checkout-west-update@main

- name: cache-pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip

- name: Install packages
run: |
sudo apt update
Expand All @@ -57,11 +56,9 @@ jobs:
sudo pip3 install -U setuptools wheel pip
pip3 install -r nrf/doc/requirements.txt
- name: West init and update
- name: West zephyr-export
working-directory: ncs
run: |
west init -l nrf
west update
west zephyr-export
- name: Build documentation
Expand Down
33 changes: 7 additions & 26 deletions .github/workflows/license-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ name: Reusable License Check
on:
workflow_call:
inputs:

path:
# Required path to your module relative to west workspace.
type: string
Expand All @@ -32,28 +31,18 @@ on:
type: string
default: nrf/scripts/ci/license_allow_list.yaml

nrf_repo:
# Optional URL of the custom "sdk-nrf" repository that contains license check
# script and the west manifest. By default official "sdk-nrf" repository is used.
type: string
default: https://github.com/nrfconnect/sdk-nrf

nrf_rev:
# Optional revision of the "sdk-nrf" repository. By default, "main" is used.
type: string
default: main

jobs:
license_job:
runs-on: ubuntu-latest
name: Run license checks on patch series (PR)
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Checkout sources
uses: nordicbuilder/action-checkout-west-update@main
with:
git-fetch-depth: 0
git-ref: ${{ github.event.pull_request.head.sha }}
path: ncs/${{ inputs.path }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
west-update-args: '-n zephyr bsim'

- name: cache-pip
uses: actions/cache@v1
Expand All @@ -70,32 +59,24 @@ jobs:
pip3 install --user -U west
pip3 show -f west
- name: Git config and rebase
- name: Git rebase
env:
BASE_REF: ${{ github.base_ref }}
working-directory: ncs/${{ inputs.path }}
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git remote -v
git branch
git rebase origin/${BASE_REF}
# debug
git log --pretty=oneline | head -n 10
- name: West init and update
- name: West zephyr-export
working-directory: ncs
env:
PR_REF: ${{ github.event.pull_request.head.sha }}
run: |
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/bin:$PATH"
if [ "${{ inputs.path }}" = "nrf" ]; then
west init -l nrf
else
west init -m ${{ inputs.nrf_repo }} --mr ${{ inputs.nrf_rev }}
fi
west update -n zephyr bsim
west zephyr-export
echo "ZEPHYR_BASE=$(pwd)/zephyr" >> $GITHUB_ENV
# debug
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/oss-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ jobs:
runs-on: ubuntu-latest
name: Check OSS history
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Checkout sources
uses: nordicbuilder/action-checkout-west-update@main
with:
path: ncs/nrf
fetch-depth: 0
git-fetch-depth: 0
west-update-args: ''

- name: Install extra python dependencies
run: |
pip3 install west
pip3 install -r ncs/nrf/scripts/requirements-extra.txt
- name: Set up the workspace
- name: Set upsteam
working-directory: ncs
run: |
west init -l ncs/nrf
cd ncs
west update
git -C zephyr remote add upstream https://github.com/zephyrproject-rtos/zephyr
- name: Check manifest userdata
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/pip-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ jobs:
check-requirements:
runs-on: ubuntu-20.04
steps:
- name: Checkout PR target branch
uses: actions/checkout@v4
- name: Checkout sources
uses: nordicbuilder/action-checkout-west-update@main
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ncs/nrf
fetch-depth: 1
persist-credentials: false
git-ref: ${{ github.event.pull_request.head.sha }}
west-update-args: '--narrow mcuboot zephyr'

- name: Get python version
id: pyv
Expand All @@ -39,9 +37,7 @@ jobs:
- name: Setup environment
working-directory: ncs
run: |
pip3 install --user -U setuptools wheel pip virtualenv virtualenvwrapper west
west init -l nrf
west update --narrow mcuboot zephyr
pip3 install --user -U setuptools wheel pip virtualenv virtualenvwrapper
- name: Execute script diff action
uses: nordicbuilder/action-script-diff@v0.1
Expand Down

0 comments on commit 5e4d94b

Please sign in to comment.