[FIX] run tests: shell checkout (doodba image has no node)
This commit is contained in:
@@ -19,25 +19,60 @@ jobs:
|
|||||||
POSTGRES_PASSWORD: odoopassword
|
POSTGRES_PASSWORD: odoopassword
|
||||||
POSTGRES_DB: postgres
|
POSTGRES_DB: postgres
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# The doodba image ships no Node.js, so actions/checkout@v4 cannot
|
||||||
with:
|
# run here. The repository is private, so the job token is required.
|
||||||
fetch-depth: 0
|
- name: Checkout
|
||||||
|
env:
|
||||||
|
SECRET_GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-${SECRET_GITEA_TOKEN:-${SECRET_GITHUB_TOKEN:-}}}}"
|
||||||
|
if [ -z "$token" ]; then
|
||||||
|
echo "::error::No job token available to clone the repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
server="${GITHUB_SERVER_URL:-https://git.elabore.coop}"
|
||||||
|
repo="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is not set}"
|
||||||
|
ref="${GITHUB_REF:-${GITHUB_SHA:?neither GITHUB_REF nor GITHUB_SHA is set}}"
|
||||||
|
auth_url="$(printf '%s' "${server%/}/${repo}.git" |
|
||||||
|
sed -E "s#^https://#https://${token}@#")"
|
||||||
|
git init -q .
|
||||||
|
git config --global --add safe.directory "$PWD"
|
||||||
|
git remote add origin "$auth_url"
|
||||||
|
git fetch -q --depth=1 origin "$ref"
|
||||||
|
git checkout -q FETCH_HEAD
|
||||||
|
|
||||||
- name: Detect changed modules
|
- name: Detect changed modules
|
||||||
id: changed
|
id: changed
|
||||||
run: |
|
run: |
|
||||||
base="${{ gitea.base_ref }}"
|
set -eu
|
||||||
base="${base:-${{ gitea.event.pull_request.base.ref }}}"
|
if [ -n "${GITHUB_BASE_REF:-}" ]; then
|
||||||
git fetch origin "$base"
|
git fetch -q --depth=1 origin "refs/heads/$GITHUB_BASE_REF"
|
||||||
modules="$(
|
base_rev="FETCH_HEAD"
|
||||||
git diff --name-only "origin/$base...HEAD" |
|
scope="diff against $GITHUB_BASE_REF"
|
||||||
awk -F/ '{print $1}' | sort -u |
|
else
|
||||||
while read -r dir; do
|
base_rev=""
|
||||||
|
scope="all installable modules (manual run)"
|
||||||
|
fi
|
||||||
|
if [ -n "$base_rev" ]; then
|
||||||
|
modules="$(
|
||||||
|
git diff --name-only "$base_rev" HEAD |
|
||||||
|
awk -F/ '{print $1}' | sort -u |
|
||||||
|
while read -r dir; do
|
||||||
|
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
||||||
|
done | paste -sd, -
|
||||||
|
)"
|
||||||
|
else
|
||||||
|
modules="$(
|
||||||
|
for dir in */; do
|
||||||
|
dir="${dir%/}"
|
||||||
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
||||||
done | paste -sd, -
|
done | paste -sd, -
|
||||||
)"
|
)"
|
||||||
|
fi
|
||||||
echo "modules=$modules" >> "$GITHUB_OUTPUT"
|
echo "modules=$modules" >> "$GITHUB_OUTPUT"
|
||||||
echo "Changed installable modules: ${modules:-<none>}"
|
echo "Modules to test ($scope): ${modules:-<none>}"
|
||||||
|
|
||||||
- name: Run Odoo tests
|
- name: Run Odoo tests
|
||||||
if: steps.changed.outputs.modules != ''
|
if: steps.changed.outputs.modules != ''
|
||||||
|
|||||||
@@ -19,25 +19,60 @@ jobs:
|
|||||||
POSTGRES_PASSWORD: odoopassword
|
POSTGRES_PASSWORD: odoopassword
|
||||||
POSTGRES_DB: postgres
|
POSTGRES_DB: postgres
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# The doodba image ships no Node.js, so actions/checkout@v4 cannot
|
||||||
with:
|
# run here. The repository is private, so the job token is required.
|
||||||
fetch-depth: 0
|
- name: Checkout
|
||||||
|
env:
|
||||||
|
SECRET_GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-${SECRET_GITEA_TOKEN:-${SECRET_GITHUB_TOKEN:-}}}}"
|
||||||
|
if [ -z "$token" ]; then
|
||||||
|
echo "::error::No job token available to clone the repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
server="${GITHUB_SERVER_URL:-https://git.elabore.coop}"
|
||||||
|
repo="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is not set}"
|
||||||
|
ref="${GITHUB_REF:-${GITHUB_SHA:?neither GITHUB_REF nor GITHUB_SHA is set}}"
|
||||||
|
auth_url="$(printf '%s' "${server%/}/${repo}.git" |
|
||||||
|
sed -E "s#^https://#https://${token}@#")"
|
||||||
|
git init -q .
|
||||||
|
git config --global --add safe.directory "$PWD"
|
||||||
|
git remote add origin "$auth_url"
|
||||||
|
git fetch -q --depth=1 origin "$ref"
|
||||||
|
git checkout -q FETCH_HEAD
|
||||||
|
|
||||||
- name: Detect changed modules
|
- name: Detect changed modules
|
||||||
id: changed
|
id: changed
|
||||||
run: |
|
run: |
|
||||||
base="${{ gitea.base_ref }}"
|
set -eu
|
||||||
base="${base:-${{ gitea.event.pull_request.base.ref }}}"
|
if [ -n "${GITHUB_BASE_REF:-}" ]; then
|
||||||
git fetch origin "$base"
|
git fetch -q --depth=1 origin "refs/heads/$GITHUB_BASE_REF"
|
||||||
modules="$(
|
base_rev="FETCH_HEAD"
|
||||||
git diff --name-only "origin/$base...HEAD" |
|
scope="diff against $GITHUB_BASE_REF"
|
||||||
awk -F/ '{print $1}' | sort -u |
|
else
|
||||||
while read -r dir; do
|
base_rev=""
|
||||||
|
scope="all installable modules (manual run)"
|
||||||
|
fi
|
||||||
|
if [ -n "$base_rev" ]; then
|
||||||
|
modules="$(
|
||||||
|
git diff --name-only "$base_rev" HEAD |
|
||||||
|
awk -F/ '{print $1}' | sort -u |
|
||||||
|
while read -r dir; do
|
||||||
|
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
||||||
|
done | paste -sd, -
|
||||||
|
)"
|
||||||
|
else
|
||||||
|
modules="$(
|
||||||
|
for dir in */; do
|
||||||
|
dir="${dir%/}"
|
||||||
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
[ -f "$dir/__manifest__.py" ] && echo "$dir"
|
||||||
done | paste -sd, -
|
done | paste -sd, -
|
||||||
)"
|
)"
|
||||||
|
fi
|
||||||
echo "modules=$modules" >> "$GITHUB_OUTPUT"
|
echo "modules=$modules" >> "$GITHUB_OUTPUT"
|
||||||
echo "Changed installable modules: ${modules:-<none>}"
|
echo "Modules to test ($scope): ${modules:-<none>}"
|
||||||
|
|
||||||
- name: Run Odoo tests
|
- name: Run Odoo tests
|
||||||
if: steps.changed.outputs.modules != ''
|
if: steps.changed.outputs.modules != ''
|
||||||
|
|||||||
Reference in New Issue
Block a user