make pulpstatus the default screen, noAuth #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress | |
on: | |
# allow running manually | |
workflow_dispatch: | |
pull_request: | |
branches: [ 'main' ] | |
push: | |
branches: [ 'main' ] | |
# weekly on main | |
schedule: | |
- cron: '20 4 * * 6' | |
concurrency: | |
group: cypress-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cypress: | |
runs-on: ubuntu-latest | |
env: | |
# base of a PR, or pushed-to branch outside PRs, or main | |
BRANCH: ${{ github.base_ref || github.ref || 'refs/heads/main' }} | |
strategy: | |
fail-fast: false | |
steps: | |
- name: "Set env.SHORT_BRANCH" | |
run: | | |
SHORT_BRANCH=`sed 's/^refs\/heads\///' <<< $BRANCH` | |
echo "SHORT_BRANCH=${SHORT_BRANCH}" >> $GITHUB_ENV | |
- name: "Checkout pulp-ui (${{ github.ref }})" | |
uses: actions/checkout@v4 | |
with: | |
path: 'pulp-ui' | |
- name: "buildah build" | |
working-directory: 'pulp-ui/.github/workflows/cypress' | |
run: 'buildah build -t localhost/pulp:latest -f ./Containerfile' | |
- name: "podman run" | |
run: 'podman run --replace --name pulp --publish 8080:80 --detach localhost/pulp:latest' | |
- name: "Install node 20" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: "Cache ~/.npm & ~/.cache/Cypress" | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
~/.cache/Cypress | |
key: npm-${{ env.SHORT_BRANCH }}-${{ hashFiles('pulp-ui/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.SHORT_BRANCH }}- | |
- name: 'npm install' | |
working-directory: 'pulp-ui' | |
run: 'npm install' | |
- name: 'gettext extract & compile' | |
working-directory: 'pulp-ui' | |
run: | | |
# production displays unknown translations literally, make sure it's up to date | |
npm run gettext:extract | |
npm run gettext:compile | |
- name: "Build UI" | |
working-directory: 'pulp-ui' | |
run: | | |
npm run build | |
# save the App.*.js hash for later verification | |
BUILD_HASH=`ls dist/js/App*js | cut -d. -f2` | |
echo "BUILD_HASH=${BUILD_HASH}" >> $GITHUB_ENV | |
- name: "Serve UI" | |
run: | | |
mkdir -p www/static/ | |
mv pulp-ui/dist www/static/pulp_ui | |
cd www | |
echo '{}' > package.json | |
npm install local-web-server | |
node_modules/.bin/ws \ | |
--port 8002 \ | |
--directory . \ | |
--spa static/pulp_ui/index.html \ | |
--rewrite '/api/(.*) -> http://localhost:5001/api/$1' \ | |
--rewrite '/assets/(.*) -> http://localhost:5001/assets/$1' \ | |
--rewrite '/extensions/(.*) -> http://localhost:5001/extensions/$1' \ | |
--rewrite '/pulp/(.*) -> http://localhost:5001/pulp/$1' \ | |
--rewrite '/static/rest_framework/(.*) -> http://localhost:5001/static/rest_framework/$1' \ | |
--rewrite '/v2/(.*) -> http://localhost:5001/v2/$1' & | |
- name: "Ensure index.html uses the new js" | |
run: | | |
echo 'expecting /static/pulp_ui/js/App.'"$BUILD_HASH"'.js' | |
curl http://localhost:8002/static/pulp_ui/index.html | tee /dev/stderr | grep '/static/pulp_ui/js/App.'"$BUILD_HASH"'.js' | |
- name: "Check status endpoint" | |
run: | | |
curl -s -f http://localhost:5001/pulp/api/v3/status/ | jq | |
- name: "Change admin password" | |
run: | | |
podman exec -it pulp pulpcore-manager reset-admin-password --password admin | |
- name: "Check login works" | |
run: | | |
curl -s -f --user admin:admin http://localhost:5001/pulp/api/v3/repositories/python/python/ | jq | |
- name: "Run cypress" | |
working-directory: 'pulp-ui' | |
env: | |
CONSOLE_LOG_TO_TERMINAL: true | |
run: | | |
npm run cypress:chrome | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: screenshots_and_videos | |
path: | | |
pulp-ui/cypress/screenshots | |
pulp-ui/cypress/videos | |
- name: "Kill container, show logs" | |
if: always() | |
run: | | |
podman logs pulp | |
podman kill pulp |