Skip to content

[WTF-2713]: Build PWT artifacts during PR pipeline for testing #873

[WTF-2713]: Build PWT artifacts during PR pipeline for testing

[WTF-2713]: Build PWT artifacts during PR pipeline for testing #873

Workflow file for this run

name: Test & Build
on:
push:
branches: [master]
paths:
- 'pnpm-lock.yaml'
- 'packages/**'
pull_request:
branches: [master]
paths:
- 'pnpm-lock.yaml'
- 'packages/**'
jobs:
test-build:
name: "Quality Checks & Build"
runs-on: ubuntu-latest
steps:
- name: "Checking-out code"
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2
with:
submodules: false
- name: Setup pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
- name: "Defining node version"
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: ".nvmrc"
cache: 'pnpm'
- name: "Installing dependencies"
run: pnpm install
- name: "Running unit tests"
run: pnpm -r test
- name: "Linting packages"
run: pnpm lint
- name: "Linting changelogs"
run: |
failures=0
for changelog in $(find . -type f -name CHANGELOG.md -mindepth 3 -maxdepth 3); do
echo "Parsing $changelog"
if pnpm exec changelog-parser parse $changelog; then
:
else
: $((failures++))
fi
done
if [[ $failures -gt 0 ]]; then
exit 1;
fi
- name: "Build packages"
run: pnpm -r pack
- name: "Prepare artifacts"
id: prepare-artifacts
run: |
mkdir artifacts
sha_short=$(echo "$GITHUB_SHA" | head -c 7)
for package in $(ls *.tgz); do
revisioned=$(echo "$package" | sed -e "s/^\(.*\)\(.tgz\)/\1-$sha_short\2/")
mv $package ./artifacts/$revisioned
done
SAFE_GIT_REF="$(echo '${{github.ref_name}}' | sed -e 's/^\(.*\)\/merge$/pr\1/' -e 's/\//__/g')"
printf 'PACKAGES_NAME=widgets-tools.%s.%s' "$SAFE_GIT_REF" "${{ github.run_number }}" >> "$GITHUB_OUTPUT"
- name: "Archive artifacts"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
id: archive-artifacts
with:
name: ${{ steps.prepare-artifacts.outputs.PACKAGES_NAME }}
path: artifacts/*.tgz
retention-days: 5