Bygger og tester refactor: update file-input styling and color handling #2680
Workflow file for this run
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: Pull Request | |
on: | |
pull_request: | |
branches: ["main"] | |
merge_group: | |
types: [checks_requested] | |
run-name: Bygger og tester ${{ github.event_name == 'merge_group' && github.event.merge_group.head_commit.message || github.event.pull_request.title }} | |
env: | |
PREVIEW_PATH: preview/${{ github.event.pull_request.head.ref }} | |
PREFIX_PATHS: true | |
## | |
# Sjekker først om det er endringer som krever grundigere test. | |
# Bygger i så fall pakkene og cacher dem via Nx. | |
# Bygger så portalen og en branch preview dersom det er visuelle endringer og cacher på samme måte. | |
# Cachen lastes ned av jobbene testlint, cypress. | |
# Førstnevnte kjører enhetstester, ESLint, og TypeScript typesjekk. | |
# N instanser av cypress-jobben spinner opp og kjører deler av testene fordelt mellom seg. | |
# Om en jobb har nye snapshots lastes disse opp som en artifact. | |
# Til slutt sjekker en jobb om nye snapshots har blitt generert av en eller | |
# flere av cypressjobbene. I så fall samles disse i én commit | |
# som pushes til branchen som testes. | |
## | |
jobs: | |
build: | |
name: Sjekk for endringer og bygg pakker | |
if: ${{ !contains(github.event.sender.login, 'fremtind-bot') }} | |
outputs: | |
visual: ${{ steps.changes.outputs.visual }} | |
preview: ${{ steps.changes.outputs.preview }} | |
testlint: ${{ steps.changes.outputs.testlint }} | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check for changes that require extra verification | |
if: ${{ github.event_name != 'merge_group' }} | |
uses: ./actions/paths-filter | |
id: changes | |
with: | |
filters: | | |
testlint: | |
- "**/*.js" | |
- "**/*.scss" | |
- "**/*.ts" | |
- "**/*.tsx" | |
- "pnpm-lock.yaml" | |
visual: | |
- "cypress/**" | |
- "packages/**/*.spec.js" | |
- "packages/**/*.scss" | |
- "packages/core/**/!(*.d|*.test).ts" | |
- "packages/core/**/!(*.test).tsx" | |
- "packages/*-react/**/!(*.d|*.test).ts" | |
- "packages/*-react/**/!(*.test).tsx" | |
- "pnpm-lock.yaml" | |
preview: | |
- "packages/**/*.mdx" | |
- "portal/src/texts/**" | |
- name: Setup pnpm | |
if: steps.changes.outputs.has_matches == 'true' || github.event_name == 'merge_group' | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
if: steps.changes.outputs.has_matches == 'true' || github.event_name == 'merge_group' | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Monorepo Runner Cache | |
if: steps.changes.outputs.has_matches == 'true' || github.event_name == 'merge_group' | |
uses: actions/cache@v3 | |
id: nx-cache | |
with: | |
path: .nx | |
key: nx-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }} | |
restore-keys: | | |
nx-${{ hashFiles('pnpm-lock.yaml') }}- | |
- name: Install dependencies and build packages | |
if: steps.changes.outputs.has_matches == 'true' || github.event_name == 'merge_group' | |
run: pnpm ci:install | |
preview: | |
name: Publiser forhåndsvisning | |
needs: [build] | |
if: github.event_name != 'merge_group' && (needs.build.outputs.visual == 'true' || needs.build.outputs.preview == 'true') | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Monorepo Runner Cache | |
uses: actions/cache@v3 | |
id: nx-cache | |
with: | |
path: .nx | |
key: nx-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }} | |
restore-keys: | | |
nx-${{ hashFiles('pnpm-lock.yaml') }}- | |
# Steget må være med, men vil være cachet | |
- name: Install dependencies and build packages | |
run: pnpm ci:install | |
- name: Add a comment with a link to the preview | |
uses: marocchino/sticky-pull-request-comment@da224cb0e3c8b27cae68d40c93649421b5b93e45 | |
with: | |
header: preview | |
GITHUB_TOKEN: ${{ secrets.FREMTIND_BOT_ACCESS_TOKEN }} | |
message: | | |
<span aria-hidden="true">🔄</span> **Gjør klar en forhåndsvisning…** | |
<span aria-hidden="true">🔍</span> Commit: ${{ github.sha }} | |
- name: Build site | |
env: | |
GATSBY_MIXPANEL_PROJECT_ID: ${{ secrets.MIXPANEL_PROJECT_ID_TEST }} | |
run: pnpm build:docs | |
- name: Deploy preview | |
env: | |
GH_TOKEN: ${{ secrets.BOT_PUBLISH_TOKEN }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "fremtind-bot" | |
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/fremtind/jokul.git | |
pnpm gh-pages --add --dist portal/public --dest ${{ env.PREVIEW_PATH }} --message "docs: preview #${{ github.event.number }}" | |
- name: Add a comment with a link to the preview | |
uses: marocchino/sticky-pull-request-comment@da224cb0e3c8b27cae68d40c93649421b5b93e45 | |
with: | |
header: preview | |
GITHUB_TOKEN: ${{ secrets.FREMTIND_BOT_ACCESS_TOKEN }} | |
message: | | |
<span aria-hidden="true">✅</span> Forhåndsvisning: https://jokul.fremtind.no/${{ env.PREVIEW_PATH }}/ | |
<span aria-hidden="true">🔍</span> Commit: ${{ github.sha }} | |
Forhåndsvisningen blir tilgjengelig innen et par minutter. Den fjernes automatisk når pull requesten lukkes. | |
testlint: | |
name: Kjør tester og linting | |
needs: [build] | |
if: github.event_name == 'merge_group' || (needs.build.outputs.testlint == 'true' && !contains(github.event.sender.login, 'fremtind-bot')) | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Monorepo Runner Cache | |
uses: actions/cache@v3 | |
id: nx-cache | |
with: | |
path: .nx | |
key: nx-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }} | |
restore-keys: | | |
nx-${{ hashFiles('pnpm-lock.yaml') }}- | |
# Steget må være med, men vil være cachet | |
- name: Install dependencies and build packages | |
run: pnpm ci:install | |
- name: Lint and test | |
run: pnpm ci:test |