-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split build and test workflows (#496)
* test * split * pr number
- Loading branch information
1 parent
7020999
commit 43b1728
Showing
4 changed files
with
123 additions
and
112 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,115 +20,7 @@ jobs: | |
- name: Upload built project | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: ./dist | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-pnpm | ||
|
||
- run: | | ||
pnpm install | ||
cd ./node_modules/puppeteer | ||
pnpm install | ||
- run: pnpm run build:development | ||
|
||
- name: Lint | ||
run: pnpm lint | ||
|
||
- name: Run unit tests | ||
run: pnpm test | ||
|
||
- name: Run end-to-end tests | ||
run: pnpm test-puppeteer-build | ||
|
||
# bundle_size: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - uses: ./.github/actions/setup-pnpm | ||
# - uses: preactjs/compressed-size-action@v2 | ||
# with: | ||
# repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
# build-script: build:production | ||
# pattern: "./dist/assets/*.{css,js}" | ||
# strip-hash: "\\b-\\w{8}" | ||
# minimum-change-threshold: 100 | ||
|
||
lighthouse: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-pnpm | ||
|
||
- run: pnpm install | ||
- run: pnpm build:production | ||
|
||
- name: run Lighthouse CI | ||
run: | | ||
pnpm add -g @lhci/[email protected] | ||
lhci autorun | ||
env: | ||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/connect' | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/commaai/connect | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=ref,event=branch | ||
type=ref,event=pr,prefix= | ||
type=sha,format=long,prefix= | ||
env: | ||
DOCKER_METADATA_PR_HEAD_SHA: true | ||
|
||
- name: get date | ||
run: echo "GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV | ||
|
||
- uses: docker/build-push-action@v4 | ||
with: | ||
build-args: | | ||
VITE_APP_GIT_SHA=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | ||
VITE_APP_GIT_TIMESTAMP=${{ env.GIT_TIMESTAMP }} | ||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
- run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
overwrite: true | ||
retention-days: 1 | ||
name: build-artifacts-${{ github.event.number }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup-pnpm | ||
|
||
- run: | | ||
pnpm install | ||
cd ./node_modules/puppeteer | ||
pnpm install | ||
- run: pnpm run build:development | ||
|
||
- name: Lint | ||
run: pnpm lint | ||
|
||
- name: Run unit tests | ||
run: pnpm test | ||
|
||
- name: Run end-to-end tests | ||
run: pnpm test-puppeteer-build | ||
|
||
# bundle_size: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - uses: ./.github/actions/setup-pnpm | ||
# - uses: preactjs/compressed-size-action@v2 | ||
# with: | ||
# repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
# build-script: build:production | ||
# pattern: "./dist/assets/*.{css,js}" | ||
# strip-hash: "\\b-\\w{8}" | ||
# minimum-change-threshold: 100 | ||
|
||
lighthouse: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-pnpm | ||
|
||
- run: pnpm install | ||
- run: pnpm build:production | ||
|
||
- name: run Lighthouse CI | ||
run: | | ||
pnpm add -g @lhci/[email protected] | ||
lhci autorun | ||
env: | ||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/connect' | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/commaai/connect | ||
tags: | | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=ref,event=branch | ||
type=ref,event=pr,prefix= | ||
type=sha,format=long,prefix= | ||
env: | ||
DOCKER_METADATA_PR_HEAD_SHA: true | ||
|
||
- name: get date | ||
run: echo "GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV | ||
|
||
- uses: docker/build-push-action@v4 | ||
with: | ||
build-args: | | ||
VITE_APP_GIT_SHA=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | ||
VITE_APP_GIT_TIMESTAMP=${{ env.GIT_TIMESTAMP }} | ||
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }} | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
- run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |