Skip to content

Commit 04bb015

Browse files
committed
Merge branch 'charmed-snapcraft-io' into staging
2 parents 88d8d1e + 606b965 commit 04bb015

198 files changed

Lines changed: 8094 additions & 3301 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/coverage.yml

Lines changed: 88 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ name: Test coverage
22
on:
33
schedule:
44
- cron: "0 22 * * *"
5+
workflow_dispatch: # Allows manual triggering
56

67
jobs:
78
test:
89
name: test
910
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
1013

1114
steps:
12-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1316

1417
- uses: actions/setup-node@v4
1518
with:
@@ -39,93 +42,110 @@ jobs:
3942
- name: Zip coverage report
4043
run: |
4144
zip -r coverage/cobertura-coverage.zip coverage/cobertura-coverage.xml coverage/coverage.xml
42-
45+
4346
- name: Upload coverage report
4447
if: always()
4548
uses: actions/upload-artifact@v4
4649
with:
4750
name: snapcraftio-coverage
4851
path: coverage
4952
retention-days: 1
50-
51-
publish-coverage-report:
52-
name: publish-coverage-report
53-
runs-on: ubuntu-latest
54-
needs: test
55-
continue-on-error: true
56-
steps:
57-
- uses: actions/checkout@v4
58-
with:
59-
ref: gh-pages
60-
token: ${{ secrets.GITHUB_TOKEN }}
61-
- name: Cleanup coverage directory
62-
run: |
63-
rm -rf coverage
64-
mkdir coverage
65-
- name: Download coverage report artifact
66-
uses: actions/download-artifact@v4
67-
with:
68-
name: snapcraftio-coverage
69-
path: coverage
70-
# user git configs are needed for git commands to work
71-
# actual authentication is done using secrets.GITHUB_TOKEN with write permission
72-
- name: Set Git User
73-
run: |
74-
git config --global user.email "github-action@example.com"
75-
git config --global user.name "GitHub Action"
76-
- name: Push coverage Report
77-
timeout-minutes: 3
78-
run: |
79-
git add .
80-
git commit -m "workflow: update coverage report"
81-
82-
# In case of another action job pushing to gh-pages while we are rebasing for the current job
83-
while true; do
84-
git pull --rebase
85-
if [ $? -ne 0 ]; then
86-
echo "Failed to rebase. Please review manually."
87-
exit 1
88-
fi
89-
90-
git push
91-
if [ $? -eq 0 ]; then
92-
echo "Successfully pushed HTML report to repo."
93-
exit 0
94-
fi
95-
done
96-
- name: Output Report URL as Worfklow Annotation
97-
run: |
98-
FULL_HTML_REPORT_URL=https://canonical.github.io/snapcraft.io/coverage
99-
echo "::notice title=Published Playwright Test Report::$FULL_HTML_REPORT_URL"
10053

54+
publish-coverage-report:
55+
name: publish-coverage-report
56+
runs-on: ubuntu-latest
57+
needs: test
58+
permissions:
59+
contents: write
60+
continue-on-error: true
61+
steps:
62+
- uses: actions/checkout@v5
63+
with:
64+
ref: gh-pages
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
- name: Cleanup coverage directory
67+
run: |
68+
rm -rf coverage
69+
mkdir coverage
70+
- name: Download coverage report artifact
71+
uses: actions/download-artifact@v5
72+
with:
73+
name: snapcraftio-coverage
74+
path: coverage
75+
# user git configs are needed for git commands to work
76+
# actual authentication is done using secrets.GITHUB_TOKEN with write permission
77+
- name: Set Git User
78+
run: |
79+
git config --global user.email "github-action@example.com"
80+
git config --global user.name "GitHub Action"
81+
- name: Push coverage Report
82+
timeout-minutes: 3
83+
run: |
84+
git add .
85+
git commit -m "workflow: update coverage report"
86+
87+
# In case of another action job pushing to gh-pages while we are rebasing for the current job
88+
while true; do
89+
git pull --rebase
90+
if [ $? -ne 0 ]; then
91+
echo "Failed to rebase. Please review manually."
92+
exit 1
93+
fi
94+
95+
git push
96+
if [ $? -eq 0 ]; then
97+
echo "Successfully pushed HTML report to repo."
98+
exit 0
99+
fi
100+
done
101+
- name: Output Report URL as Worfklow Annotation
102+
run: |
103+
FULL_HTML_REPORT_URL=https://canonical.github.io/snapcraft.io/coverage
104+
echo "::notice title=Published Playwright Test Report::$FULL_HTML_REPORT_URL"
101105
102106
tics-report:
103-
runs-on: ubuntu-latest
107+
runs-on: [self-hosted, reactive, amd64, tiobe, noble]
108+
permissions:
109+
contents: read
104110
needs: publish-coverage-report
105111
steps:
106-
- uses: actions/checkout@v4
112+
- uses: actions/checkout@v5
107113

108114
- name: Download coverage report artifact
109-
uses: actions/download-artifact@v4
115+
uses: actions/download-artifact@v5
110116
with:
111117
name: snapcraftio-coverage
112118
path: coverage
113119

120+
- name: Set up Python 3.10
121+
uses: actions/setup-python@v5
122+
with:
123+
python-version: "3.10"
124+
cache: "pip"
125+
126+
- name: Set up Node.js
127+
uses: actions/setup-node@v4
128+
with:
129+
node-version: "22"
130+
cache: "yarn"
131+
114132
- name: Install Python requirements
115133
run: |
116-
sudo pip3 install -r requirements.txt
117-
118-
- name: Install Python dependencies
119-
run: sudo pip3 install pylint
134+
python -m pip install --upgrade pip
135+
pip3 install -r requirements.txt
136+
pip3 install pylint
120137
121138
- name: Install JS dependencies
122-
run: yarn install --immutable
123-
124-
- name: Produce TICS report
125-
shell: bash
126139
run: |
127-
set -x
128-
export TICSAUTHTOKEN=${{ secrets.TICSAUTHTOKEN }}
129-
curl --silent --show-error "https://canonical.tiobe.com/tiobeweb/TICS/api/public/v1/fapi/installtics/Script?cfg=default&platform=linux&url=https://canonical.tiobe.com/tiobeweb/TICS/" > install_tics.sh
130-
. ./install_tics.sh
131-
TICSQServer -project snapcraft.io -tmpdir /tmp/tics -branchdir . -nosanity
140+
yarn install --immutable
141+
142+
- name: Run TICS analysis with github-action
143+
uses: tiobe/tics-github-action@v3
144+
with:
145+
mode: qserver
146+
project: snapcraft.io
147+
branchdir: .
148+
viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default
149+
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
150+
installTics: true
151+

.github/workflows/pr.yml

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ env:
88
jobs:
99
run-image:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
1113
steps:
12-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1315
- name: Build image
1416
run: DOCKER_BUILDKIT=1 docker build --tag snapcraft-io .
1517
- name: Run image
@@ -19,9 +21,10 @@ jobs:
1921
2022
run-dotrun:
2123
runs-on: ubuntu-latest
22-
24+
permissions:
25+
contents: read
2326
steps:
24-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v5
2528

2629
- name: Install Dotrun
2730
run: |
@@ -43,7 +46,7 @@ jobs:
4346
pack-rock:
4447
runs-on: ubuntu-latest
4548
steps:
46-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
4750

4851
- name: Setup LXD
4952
uses: canonical/setup-lxd@main
@@ -54,12 +57,44 @@ jobs:
5457
- name: Pack rock
5558
run: rockcraft pack
5659

57-
lint-python:
60+
run-cypress:
5861
runs-on: ubuntu-latest
62+
permissions:
63+
contents: read
64+
steps:
65+
# START copy of the run-dotrun job
66+
- uses: actions/checkout@v5
67+
68+
- name: Install Dotrun
69+
run: |
70+
sudo pip3 install dotrun requests==2.31.0 # requests version is pinned to avoid breaking changes, can be removed once issue is resolved: https://github.com/docker/docker-py/issues/3256
5971
72+
- name: Install dependencies
73+
run: |
74+
sudo chmod -R 777 .
75+
dotrun install
76+
77+
- name: Build assets
78+
run: dotrun build
79+
80+
- name: Run dotrun
81+
run: |
82+
dotrun &
83+
curl --head --fail --retry-delay 3 --retry 30 --retry-connrefused http://localhost:8004
84+
# END copy of the run-dotrun job
85+
86+
- name: Run Cypress as a Docker container
87+
run: |
88+
docker run --network="host" -v .:/app cypress/base:22.18.0 \
89+
bash "-c" "cd /app && npx cypress install && yarn run test-e2e"
90+
91+
lint-python:
92+
runs-on: ubuntu-latest
93+
permissions:
94+
contents: read
6095
steps:
6196
- name: Checkout
62-
uses: actions/checkout@v4
97+
uses: actions/checkout@v5
6398
- uses: dorny/paths-filter@v3
6499
id: filter
65100
with:
@@ -87,9 +122,11 @@ jobs:
87122

88123
lint-scss:
89124
runs-on: ubuntu-latest
125+
permissions:
126+
contents: read
90127
steps:
91128
- name: Checkout
92-
uses: actions/checkout@v4
129+
uses: actions/checkout@v5
93130

94131
- uses: dorny/paths-filter@v3
95132
id: filter
@@ -108,9 +145,11 @@ jobs:
108145

109146
lint-js:
110147
runs-on: ubuntu-latest
148+
permissions:
149+
contents: read
111150
steps:
112151
- name: Checkout
113-
uses: actions/checkout@v4
152+
uses: actions/checkout@v5
114153

115154
- uses: dorny/paths-filter@v3
116155
id: filter
@@ -135,9 +174,12 @@ jobs:
135174

136175
test-python:
137176
runs-on: ubuntu-latest
177+
permissions:
178+
pull-requests: write
179+
contents: read
138180

139181
steps:
140-
- uses: actions/checkout@v4
182+
- uses: actions/checkout@v5
141183

142184
- uses: dorny/paths-filter@v3
143185
id: filter
@@ -176,9 +218,10 @@ jobs:
176218

177219
test-js:
178220
runs-on: ubuntu-latest
179-
221+
permissions:
222+
contents: read
180223
steps:
181-
- uses: actions/checkout@v4
224+
- uses: actions/checkout@v5
182225

183226
- uses: dorny/paths-filter@v3
184227
id: filter
@@ -214,10 +257,13 @@ jobs:
214257

215258
check-inclusive-naming:
216259
runs-on: ubuntu-latest
260+
permissions:
261+
pull-requests: write
262+
contents: read
217263

218264
steps:
219265
- name: Checkout
220-
uses: actions/checkout@v4
266+
uses: actions/checkout@v5
221267

222268
- name: Check inclusive naming
223269
uses: canonical-web-and-design/inclusive-naming@main

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ coverage/
6969
.webcache/
7070
.webcache_blog/
7171
.coverage
72+
cypress/screenshots/
7273

7374
# Charming artifacts
7475
*.charm
75-
*.rock
76+
*.rock

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/root/.cache/pip pip3 install --user --requirement
1111

1212
# Build stage: Install yarn dependencies
1313
# ===
14-
FROM node:21 AS yarn-dependencies
14+
FROM node:22 AS yarn-dependencies
1515
WORKDIR /srv
1616
ADD package.json .
1717
ADD yarn.lock .
@@ -28,9 +28,8 @@ RUN yarn run build-css
2828
# ===
2929
FROM yarn-dependencies AS build-js
3030
ADD static/js static/js
31-
ADD webpack.config.js .
32-
ADD webpack.config.entry.js .
33-
ADD webpack.config.rules.js .
31+
ADD vite.config.js .
32+
ADD vite.config.entry.js .
3433
ADD tsconfig.json .
3534
ADD babel.config.json .
3635
RUN yarn install
@@ -52,7 +51,7 @@ WORKDIR /srv
5251

5352
# Import code, build assets and mirror list
5453
ADD . .
55-
RUN rm -rf package.json yarn.lock .babelrc webpack.config.js requirements.txt
54+
RUN rm -rf package.json yarn.lock .babelrc requirements.txt
5655
COPY --from=build-css /srv/static/css static/css
5756
COPY --from=build-js /srv/static/js static/js
5857

charm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The Charm for the snapcraft.io website
22

3-
This charm was created using the [PaaS App Charmer](https://juju.is/docs/sdk/paas-charm)
3+
This charm was created using the [PaaS App Charmer](https://canonical-12-factor-app-support.readthedocs-hosted.com/latest/)
44

55
## Local development
66

0 commit comments

Comments
 (0)