Env Chores (#40)

This commit is contained in:
Ollie Taylor
2023-07-09 23:21:21 +01:00
committed by GitHub
parent 9b1238c4a1
commit 1a95ddd387
33 changed files with 5280 additions and 5442 deletions
+120 -23
View File
@@ -1,32 +1,129 @@
name: 'CI'
on:
push:
branches:
- main
pull_request:
env:
# we call `pnpm playwright install` instead
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
push:
branches:
- main
pull_request:
# cancel in-progress runs on new commits to same PR (gitub.event.number)
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
contents: read # to fetch code (actions/checkout)
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run lint
- run: pnpm run check
setup:
name: Setup Enviroment
timeout-minutes: 4
runs-on: ubuntu-latest
outputs:
cache_name: ${{ steps.cache.outputs.name }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set Node to v18.13.0
uses: actions/setup-node@v3
with:
node-version: v18.13.0
- name: Get Node version
id: node
run: echo "version=$(node -v)" >> $GITHUB_OUTPUT
#run: echo "::set-output name=version::$(node --v)"
- name: Get Cache Name
id: cache
run: echo "name=${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}" >> $GITHUB_OUTPUT
- name: Get node_modules cache
uses: actions/cache@v3
id: node_modules
with:
path: |
**/node_modules
**/.svelte-kit
key: ${{ steps.cache.outputs.name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Sync generated typings
run: yarn run sync
linting:
name: Linting Checks
needs: setup
timeout-minutes: 4
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get node_modules cache
uses: actions/cache/restore@v3
id: cache
with:
path: |
**/node_modules
**/.svelte-kit
key: ${{ needs.setup.outputs.cache_name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint prettier
run: yarn run lint:prettier
- name: Lint eslint
run: yarn run lint:eslint
type_check:
name: Typescript Checks
needs: setup
timeout-minutes: 4
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get node_modules cache
uses: actions/cache/restore@v3
id: cache
with:
path: |
**/node_modules
**/.svelte-kit
key: ${{ needs.setup.outputs.cache_name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Check for type errors
run: yarn run ts
# svelte_check:
# name: Svelte Checks
# needs: setup
# timeout-minutes: 4
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
#
# - name: Get node_modules cache
# uses: actions/cache/restore@v3
# id: cache
# with:
# path: |
# **/node_modules
# **/.svelte-kit
# key: ${{ needs.setup.outputs.cache_name }}
#
# - name: Install dependencies
# run: yarn install --frozen-lockfile
#
# - name: Check for best practices
# run: yarn run check
+79 -34
View File
@@ -1,42 +1,87 @@
name: 'Publish to NPM'
on:
push:
branches:
- 'main'
push:
branches:
- 'main'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
# prevents this action from running on forks
if: github.repository == 'OllieJT/svelte-podcast'
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/action-setup@v2.2.4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm
setup:
name: Setup Enviroment
timeout-minutes: 4
runs-on: ubuntu-latest
outputs:
cache_name: ${{ steps.cache.outputs.name }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: pnpm install --frozen-lockfile
- name: Set Node to v18.13.0
uses: actions/setup-node@v3
with:
node-version: v18.13.0
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
UPDATE_TEMPLATE_SSH_KEY: ${{ secrets.UPDATE_TEMPLATE_SSH_KEY }}
- name: Get Node version
id: node
run: echo "version=$(node -v)" >> $GITHUB_OUTPUT
#run: echo "::set-output name=version::$(node --v)"
- name: Get Cache Name
id: cache
run: echo "name=${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}" >> $GITHUB_OUTPUT
- name: Get node_modules cache
uses: actions/cache@v3
id: node_modules
with:
path: |
**/node_modules
**/.svelte-kit
key: ${{ steps.cache.outputs.name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Sync generated typings
run: yarn run sync
release:
if: github.repository == 'OllieJT/svelte-podcast'
name: Release
needs: setup
timeout-minutes: 5
runs-on: ubuntu-latest
# prevents this action from running on forks
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Get node_modules cache
uses: actions/cache/restore@v3
id: cache
with:
path: |
**/node_modules
**/.svelte-kit
key: ${{ needs.setup.outputs.cache_name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
UPDATE_TEMPLATE_SSH_KEY: ${{ secrets.UPDATE_TEMPLATE_SSH_KEY }}
-123
View File
@@ -1,123 +0,0 @@
name: 'CI'
on:
push:
branches:
- todo
env:
# we call `pnpm playwright install` instead
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
# cancel in-progress runs on new commits to same PR (gitub.event.number)
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run lint
- run: pnpm run check
Tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- node-version: 16
os: ubuntu-latest
e2e-browser: 'chromium'
- node-version: 18
os: ubuntu-latest
e2e-browser: 'chromium'
env:
KIT_E2E_BROWSER: ${{matrix.e2e-browser}}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm playwright install ${{ matrix.e2e-browser }}
- run: pnpm test
- name: Archive test results
if: failure()
shell: bash
run: find packages -type d -name test-results -not -empty | tar -czf test-results.tar.gz --files-from=-
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
retention-days: 3
name: test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
path: test-results.tar.gz
Cross-browser-test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- node-version: 16
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
e2e-browser: 'chromium'
mode: 'dev'
- node-version: 16
os: ubuntu-latest
e2e-browser: 'firefox'
mode: 'dev'
- node-version: 16
os: macOS-latest
e2e-browser: 'webkit'
mode: 'dev'
- node-version: 16
os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
e2e-browser: 'chromium'
mode: 'build'
- node-version: 16
os: ubuntu-latest
e2e-browser: 'firefox'
mode: 'build'
- node-version: 16
os: macOS-latest
e2e-browser: 'webkit'
mode: 'build'
env:
KIT_E2E_BROWSER: ${{matrix.e2e-browser}}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm playwright install ${{ matrix.e2e-browser }}
- run: pnpm test:cross-platform:${{ matrix.mode }}
- name: Archive test results
if: failure()
shell: bash
run: find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.mode }}.tar.gz --files-from=-
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
retention-days: 3
name: test-failure-cross-platform-${{ matrix.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
path: test-results-cross-platform-${{ matrix.mode }}.tar.gz