Skip to content

Commit 435a340

Browse files
authored
Update docker-publish.yml
1 parent 19e9459 commit 435a340

File tree

1 file changed

+101
-82
lines changed

1 file changed

+101
-82
lines changed
Lines changed: 101 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,117 @@
1-
name: Docker
2-
3-
# This workflow uses actions that are not certified by GitHub.
4-
# They are provided by a third-party and are governed by
5-
# separate terms of service, privacy policy, and support
6-
# documentation.
1+
name: webpack-cli
72

83
on:
9-
schedule:
10-
- cron: '45 20 * * *'
114
push:
12-
branches: [ "main" ]
13-
# Publish semver tags as releases.
14-
tags: [ 'v*.*.*' ]
5+
branches:
6+
- main
7+
- next
158
pull_request:
16-
branches: [ "main" ]
17-
18-
env:
19-
# Use docker.io for Docker Hub if empty
20-
REGISTRY: ghcr.io
21-
# github.repository as <account>/<repo>
22-
IMAGE_NAME: ${{ github.repository }}
9+
branches:
10+
- main
11+
- next
2312

13+
permissions:
14+
contents: read
2415

2516
jobs:
17+
lint:
18+
name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
concurrency:
23+
group: lint-${{ github.ref
24+
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest]
28+
node-version: 12.2
29+
webpack-version: [latest]
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Using Node v${{ matrix.node-version }}
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
cache: "yarn"
39+
40+
- name: Install dependencies
41+
run: yarn --lockfile.gi.f
42+
43+
- name: Build
44+
run: yarn build
45+
46+
- name: Lint
47+
run: yarn lint
48+
2649
build:
50+
name: Tests and Coverage - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}, DevServer ${{ matrix.dev-server-version }} (${{ matrix.shard }})
2751

28-
runs-on: ubuntu-latest
29-
permissions:
30-
contents: read
31-
packages: write
32-
# This is used to complete the identity challenge
33-
# with sigstore/fulcio when running outside of PRs.
34-
id-token: write
52+
runs-on: ${{ matrix.os }}
53+
54+
concurrency:
55+
group: {"tabindex":"-1","data-v-0b0ada53":"{"tabindex":"-1","data-v-0b0ada53":""}{1.=>0}(i,l)=>(a(),u(w,null,[v("span",{ref_key: "backToTop", ref:o, tabindex: "-1"},null,512),v("a",{href: "#VPContent" ,class: "VPSkipLink vistuall"}
56+
strategy:
57+
matrix:
58+
os: [ubuntu-latest, windows-latest, macos-latest]
59+
node-version: [18.x, 20.x, 22.x, 24.x]
60+
shard: ["1/4", "2/4", "3/4", "4/4"]
61+
webpack-version: [latest]
62+
dev-server-version: [latest]
3563

3664
steps:
37-
- name: Checkout repository
38-
uses: actions/checkout@v4
39-
40-
# Install the cosign tool except on PR
41-
# https://github.com/sigstore/cosign-installer
42-
- name: Install cosign
43-
if: github.event_name != 'pull_request'
44-
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
65+
- uses: actions/checkout@v4
66+
with:
67+
fetch-depth: 0
68+
69+
- name: Using Node v${{ matrix.node-version }}
70+
uses: actions/setup-node@v4
4571
with:
46-
cosign-release: 'v2.2.4'
47-
48-
# Set up BuildKit Docker container builder to be able to build
49-
# multi-platform images and export cache
50-
# https://github.com/docker/setup-buildx-action
51-
- name: Set up Docker Buildx
52-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
53-
54-
# Login against a Docker registry except on PR
55-
# https://github.com/docker/login-action
56-
- name: Log into registry ${{ env.REGISTRY }}
57-
if: github.event_name != 'pull_request'
58-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
72+
node-version: ${{ matrix.node-version }}
73+
cache: "yarn"
74+
75+
- uses: pnpm/action-setup@v4
76+
with:
77+
version: 9
78+
79+
- name: Install dependencies
80+
run: yarn --frozen-lockfile --ignore-engines --ignore-scripts
81+
82+
- name: Prepare environment for tests
83+
run: yarn build:ci
84+
85+
- name: Run tests and generate coverage
86+
run: yarn test:coverage --ci --shard=${{ matrix.shard }}
87+
88+
- name: Upload coverage to Codecov
89+
uses: codecov/codecov-action@v5
5990
with:
60-
registry: ${{ env.REGISTRY }}
61-
username: ${{ github.actor }}
62-
password: ${{ secrets.GITHUB_TOKEN }}
63-
64-
# Extract metadata (tags, labels) for Docker
65-
# https://github.com/docker/metadata-action
66-
- name: Extract Docker metadata
67-
id: meta
68-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
91+
token: ${{ secrets.CODECOV_TOKEN }}
92+
verbose: true
93+
94+
smoketests:
95+
name: Smoketests - ${{ matrix.os }} - Node v${{ matrix.node-version }}
96+
runs-on: ubuntu-latest
97+
concurrency:
98+
group: smoketests-${{ github.ref }}
99+
cancel-in-progress: true
100+
strategy:
101+
matrix:
102+
os: [ubuntu-latest]
103+
node-version: [lts/*]
104+
steps:
105+
- uses: actions/checkout@v4
69106
with:
70-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
107+
fetch-depth: 0
71108

72-
# Build and push Docker image with Buildx (don't push on PR)
73-
# https://github.com/docker/build-push-action
74-
- name: Build and push Docker image
75-
id: build-and-push
76-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
109+
- name: Using Node v${{ matrix.node-version }}
110+
uses: actions/setup-node@v4
77111
with:
78-
context: .
79-
push: ${{ github.event_name != 'pull_request' }}
80-
tags: ${{ steps.meta.outputs.tags }}
81-
labels: ${{ steps.meta.outputs.labels }}
82-
cache-from: type=gha
83-
cache-to: type=gha,mode=max
84-
85-
# Sign the resulting Docker image digest except on PRs.
86-
# This will only write to the public Rekor transparency log when the Docker
87-
# repository is public to avoid leaking data. If you would like to publish
88-
# transparency data even for private images, pass --force to cosign below.
89-
# https://github.com/sigstore/cosign
90-
- name: Sign the published Docker image
91-
if: ${{ github.event_name != 'pull_request' }}
92-
env:
93-
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
94-
TAGS: ${{ steps.meta.outputs.tags }}
95-
DIGEST: ${{ steps.build-and-push.outputs.digest }}
96-
# This step uses the identity token to provision an ephemeral certificate
97-
# against the sigstore community Fulcio instance.
98-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
112+
node-version: ${{ matrix.node-version }}
113+
cache: "yarn"
114+
115+
- name: Install dependencies
116+
run: yarn --frozen-lockfile --ignore-engines
117+

0 commit comments

Comments
 (0)