Skip to content

Commit 1469be3

Browse files
authored
chore: initial import (#1)
Signed-off-by: Florent Benoit <[email protected]>
1 parent 6cfdbd1 commit 1469be3

Some content is hidden

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

48 files changed

+9302
-2
lines changed

.github/dependabot.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Set update schedule for GitHub Actions
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
# check at 3am UTC
10+
time: "03:00"
11+
open-pull-requests-limit: 20
12+
13+
- package-ecosystem: "npm"
14+
directory: "/"
15+
schedule:
16+
interval: daily
17+
# check at 3am UTC
18+
time: "03:00"
19+
open-pull-requests-limit: 20
20+
groups:
21+
commitlint:
22+
applies-to: version-updates
23+
patterns:
24+
- "@commitlint/*"
25+
eslint:
26+
applies-to: version-updates
27+
patterns:
28+
- "eslint"
29+
- "@eslint/*"
30+
typescript-eslint:
31+
applies-to: version-updates
32+
patterns:
33+
- "@typescript-eslint/*"
34+
- "typescript-eslint"
35+
vitest:
36+
applies-to: version-updates
37+
patterns:
38+
- "@vitest/*"
39+
- "vitest"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: Publish codecov report from main branch
19+
20+
permissions:
21+
contents: read
22+
23+
on:
24+
workflow_dispatch:
25+
push:
26+
branches:
27+
- main
28+
29+
jobs:
30+
codecov:
31+
name: Run tests and push coverage result
32+
runs-on: ubuntu-24.04
33+
timeout-minutes: 60
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: pnpm/action-setup@v4
37+
name: Install pnpm
38+
with:
39+
run_install: false
40+
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: 22
44+
cache: 'pnpm'
45+
46+
- name: Execute pnpm
47+
run: pnpm install
48+
49+
- name: Run unit tests
50+
run: pnpm test
51+
52+
- name: publish codecov report
53+
uses: codecov/codecov-action@v5
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/next-build.yaml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: build and publish next image
19+
20+
permissions:
21+
contents: read
22+
packages: write
23+
attestations: write
24+
id-token: write
25+
26+
on:
27+
workflow_dispatch:
28+
push:
29+
branches:
30+
- main
31+
32+
jobs:
33+
check-builder-changes:
34+
runs-on: ubuntu-24.04
35+
outputs:
36+
builder_required: ${{ steps.check.outputs.builder_required }}
37+
steps:
38+
- name: Checkout Repository
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 2 # Ensure we have at least one previous commit for diff check
42+
43+
- name: Check for builder-related changes
44+
id: check
45+
run: |
46+
if git diff --name-only HEAD^ HEAD | grep -E '^(package.json|pnpm-lock.yaml|build/Containerfile.builder|.github/workflows/next-build.yaml)$'; then
47+
echo "builder_required=true" >> $GITHUB_OUTPUT
48+
else
49+
echo "builder_required=false" >> $GITHUB_OUTPUT
50+
fi
51+
52+
builder-image:
53+
needs: check-builder-changes
54+
if: needs.check-builder-changes.outputs.builder_required == 'true'
55+
name: Build and publish builder OCI images only if pnpm-lock.yaml or package.json changes
56+
runs-on: ubuntu-24.04
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Install qemu dependency
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y qemu-user-static
67+
68+
- name: build builder image
69+
id: builder-image
70+
uses: redhat-actions/buildah-build@v2
71+
with:
72+
image: podman-desktop-ibmcloud-account-ext-builder
73+
tags: next ${{ github.sha }}
74+
platforms: linux/amd64, linux/arm64
75+
containerfiles: |
76+
build/Containerfile.builder
77+
context: .
78+
oci: true
79+
80+
- name: Log in to ghcr.io
81+
uses: redhat-actions/podman-login@v1
82+
with:
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
registry: ghcr.io
86+
87+
- name: publish builder to ghcr.io
88+
id: push-to-ghcr
89+
uses: redhat-actions/push-to-registry@v2
90+
with:
91+
image: ${{ steps.builder-image.outputs.image }}
92+
tags: ${{ steps.builder-image.outputs.tags }}
93+
registry: ghcr.io/${{ github.repository_owner }}
94+
95+
- name: Generate artifact attestation
96+
uses: actions/attest-build-provenance@v2
97+
with:
98+
subject-name: ghcr.io/${{ github.repository_owner }}/podman-desktop-ibmcloud-account-ext-builder
99+
subject-digest: ${{ steps.push-to-ghcr.outputs.digest }}
100+
push-to-registry: true
101+
102+
103+
extension-image:
104+
name: Build and publish extension OCI image
105+
if: always()
106+
runs-on: ubuntu-24.04
107+
needs: builder-image
108+
109+
steps:
110+
- uses: actions/checkout@v4
111+
with:
112+
fetch-depth: 0
113+
114+
- name: Install qemu dependency
115+
run: |
116+
sudo apt-get update
117+
sudo apt-get install -y qemu-user-static
118+
119+
- name: build extension image
120+
id: extension-image
121+
uses: redhat-actions/buildah-build@v2
122+
with:
123+
image: podman-desktop-ibmcloud-account-ext
124+
tags: next ${{ github.sha }}
125+
archs: amd64, arm64
126+
containerfiles: |
127+
build/Containerfile
128+
context: .
129+
oci: true
130+
131+
- name: Log in to ghcr.io
132+
uses: redhat-actions/podman-login@v1
133+
with:
134+
username: ${{ github.actor }}
135+
password: ${{ secrets.GITHUB_TOKEN }}
136+
registry: ghcr.io
137+
138+
- name: publish extension to ghcr.io
139+
id: push-to-ghcr
140+
uses: redhat-actions/push-to-registry@v2
141+
with:
142+
image: ${{ steps.extension-image.outputs.image }}
143+
tags: ${{ steps.extension-image.outputs.tags }}
144+
registry: ghcr.io/${{ github.repository_owner }}
145+
146+
- name: Generate artifact attestation
147+
uses: actions/attest-build-provenance@v2
148+
with:
149+
subject-name: ghcr.io/${{ github.repository_owner }}/podman-desktop-ibmcloud-account-ext
150+
subject-digest: ${{ steps.push-to-ghcr.outputs.digest }}
151+
push-to-registry: true

.github/workflows/pr-check.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: pr-check
19+
20+
permissions:
21+
contents: read
22+
23+
on: [pull_request]
24+
25+
jobs:
26+
build:
27+
name: Build / ${{ matrix.os }}
28+
runs-on: ${{ matrix.os }}
29+
strategy:
30+
matrix:
31+
include:
32+
- os: "windows-2022"
33+
- os: "macos-14"
34+
- os: "ubuntu-24.04"
35+
timeout-minutes: 20
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- uses: pnpm/action-setup@v4
42+
name: Install pnpm
43+
with:
44+
run_install: false
45+
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version: 22
49+
cache: 'pnpm'
50+
51+
- name: Execute pnpm
52+
run: pnpm install --frozen-lockfile
53+
54+
- name: Run typecheck
55+
run: pnpm typecheck
56+
57+
# skip formatter on windows
58+
- name: Run formatter
59+
if: ${{ matrix.os=='ubuntu-24.04' || matrix.os=='macos-14' }}
60+
run: pnpm format:check
61+
62+
- name: Run linter
63+
run: pnpm lint:check
64+
65+
- name: Run tests
66+
run: pnpm test
67+
68+
# publish codecov report if linux
69+
- name: publish codecov report
70+
if: ${{ matrix.os=='ubuntu-24.04' }}
71+
uses: codecov/codecov-action@v5
72+
with:
73+
token: ${{ secrets.CODECOV_TOKEN }}
74+
75+
- name: Run build
76+
run: pnpm build
77+
timeout-minutes: 40

0 commit comments

Comments
 (0)