Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/cron-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
node-version: '20'
cache: 'npm'

- name: 'Install python 3.13'
uses: actions/setup-python@v5
with:
python-version: '3.13'

# FIXME: reuse pr-checks.yml?
- name: 'Checks'
run: |
Expand All @@ -55,7 +60,7 @@ jobs:
# used in npm run build
echo "PULP_UI_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: "git config"
- name: 'git config'
run: |
git config --local user.name "cron-release workflow"
git config --local user.email "pulp-ui+cron-release@example.com"
Expand All @@ -78,16 +83,16 @@ jobs:
- name: 'Build UI dist/'
run: 'npm run build'

- name: "Build a tarball"
- name: 'Build a tarball'
run: |
tar -C dist/ -czvf "$TARBALL" .

- name: "Push, push tags"
- name: 'Push, push tags'
run: |
git push
git push -f --tags

- name: "Release"
- name: 'Release'
run: |
gh release create v"$NPM_VERSION" --title "pulp-ui $NPM_VERSION $(date --iso=d)" --generate-notes
gh release upload v"$NPM_VERSION" "$TARBALL" --clobber
Expand Down
100 changes: 51 additions & 49 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,70 @@
name: "PR checks"
name: 'PR checks'

on:
pull_request:
branches: [ 'main' ]
branches: ['main']

jobs:

pr-checks:
runs-on: ubuntu-latest
steps:
- name: 'Checkout pulp-ui (${{ github.ref }})'
uses: actions/checkout@v4

- name: "Checkout pulp-ui (${{ github.ref }})"
uses: actions/checkout@v4
- name: 'Install node 20'
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: "Install node 20"
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: 'Install python 3.13'
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: "Checks"
run: |
# fail if npm install had to change package-lock.json
npm install
git diff --exit-code package-lock.json
- name: 'Checks'
run: |
# fail if npm install had to change package-lock.json
npm install
git diff --exit-code package-lock.json

# dependencies
npm run lint-setup-break-system-packages
# dependencies
npm run lint-setup

# run linters
npm run lint
# run linters
npm run lint

# uses `this` but not `class`
sudo apt install -y ripgrep
rg '\bclass\b' src/ | cut -d: -f1 | sort -u > src.class
rg '\bthis[\.,)\]}]\b' src/ | cut -d: -f1 | sort -u > src.this
if [ `comm -13 src.class src.this | wc -l` -ne 0 ]; then
echo
echo "Files using this but not class:"
echo
comm -13 src.class src.this
echo
rg '\bthis[\.,)\]}]\b' `comm -13 src.class src.this`
echo
exit 1
fi
# uses `this` but not `class`
sudo apt install -y ripgrep
rg '\bclass\b' src/ | cut -d: -f1 | sort -u > src.class
rg '\bthis[\.,)\]}]\b' src/ | cut -d: -f1 | sort -u > src.this
if [ `comm -13 src.class src.this | wc -l` -ne 0 ]; then
echo
echo "Files using this but not class:"
echo
comm -13 src.class src.this
echo
rg '\bthis[\.,)\]}]\b' `comm -13 src.class src.this`
echo
exit 1
fi

merge-commits:
runs-on: ubuntu-latest
steps:
# need to checkout out head, the merge commit won't have any merges in history
# also need more than 1 commit, assuming no PR will have more than 128
- name: 'Checkout pulp-ui HEAD'
uses: actions/checkout@v4
with:
fetch-depth: 128
ref: ${{ github.event.pull_request.head.sha }}

# need to checkout out head, the merge commit won't have any merges in history
# also need more than 1 commit, assuming no PR will have more than 128
- name: "Checkout pulp-ui HEAD"
uses: actions/checkout@v4
with:
fetch-depth: 128
ref: ${{ github.event.pull_request.head.sha }}

- name: "Ensure no merge commits"
run: |
# fail on merge commits in the PR
# since squash&merge doesn't create merge commits,
# and the last non-squash merges were in Jul 2019,
# we can just look for any merge commits since 2020
count=`git log --min-parents=2 --since 2020-01-01 | tee /dev/stderr | wc -l`
[ "$count" = 0 ]
- name: 'Ensure no merge commits'
run: |
# fail on merge commits in the PR
# since squash&merge doesn't create merge commits,
# and the last non-squash merges were in Jul 2019,
# we can just look for any merge commits since 2020
count=`git log --min-parents=2 --since 2020-01-01 | tee /dev/stderr | wc -l`
[ "$count" = 0 ]
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"css-loader": "^7.1.2",
"cypress": "^13.15.0",
"cypress-file-upload": "^5.0.8",
"eslint": "~9.12.0",
"eslint": "~9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.37.1",
"fork-ts-checker-webpack-plugin": "^9.0.2",
Expand Down Expand Up @@ -80,18 +80,15 @@
"lint": "npm-run-all lint:*",
"lint-fix": "npm-run-all lint:*:fix",
"lint-setup": "npm-run-all lint:*:setup",
"lint-setup-break-system-packages": "npm-run-all lint:*:setup-break-system-packages",
"lint:js": "npm run prettier:check && npm run eslint",
"lint:js:fix": "npm run eslint:fix && npm run prettier",
"lint:ls": "ls-lint",
"lint:po": "lint-po locale/*.po",
"lint:po:setup": "pip install --upgrade lint-po",
"lint:po:setup-break-system-packages": "pip install --upgrade --break-system-packages lint-po ",
"lint:sass": "stylelint 'src/**/*.scss' --config .stylelintrc.json",
"lint:ts": "tsc",
"lint:yaml": "yamllint .",
"lint:yaml:setup": "pip install --upgrade yamllint",
"lint:yaml:setup-break-system-packages": "pip install --upgrade --break-system-packages yamllint",
"prettier": "prettier --write 'src/**' 'config/**' 'cypress/**'",
"prettier:check": "prettier -l 'src/**' 'config/**' 'cypress/**'",
"sort-exports": "perl -i -pe 's/^export/import/' src/**/index.ts ; npm run prettier ; perl -i -pe 's/^import/export/' src/**/index.ts",
Expand Down