Skip to content

Commit

Permalink
build(gha): update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jan 4, 2024
1 parent ac571ed commit f1584bb
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 146 deletions.
24 changes: 0 additions & 24 deletions .github/actions/build/action.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/actions/test/action.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/live-api-test.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/pull-request-open.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Assign pull request author'

on:
pull_request:
types:
- opened

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
assign-author:
runs-on: ubuntu-22.04
steps:
- uses: myparcelnl/actions/pr-assign-author@v3
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/pull-request-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Label pull request'

on:
pull_request_review:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
label:
runs-on: ubuntu-22.04
steps:
- uses: myparcelnl/actions/pr-label-by-review@v3
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
label-approved: 'approved'
label-changes-requested: 'changes requested'
protection-type: 'rulesets'
20 changes: 20 additions & 0 deletions .github/workflows/pull-request-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Lint pull request title'

on:
pull_request:
types:
- opened
- edited

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: myparcelnl/actions/pr-validate-title-conventional@v3
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
68 changes: 27 additions & 41 deletions .github/workflows/release.yml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,25 @@ on:
push:
branches:
- main
# - alpha
# - beta
- beta
- alpha

paths-ignore:
- ./**/*.md
- ./screenshots/**/*

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
with:
token: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/workflows/test.yml
secrets: inherit

release:
runs-on: ubuntu-22.04
needs:
- test
- build
steps:
# TODO: replace GH_REPO_TOKEN with token generated by this step when apps can bypass status checks
- uses: myparcelnl/actions/setup-git-credentials@v3
Expand All @@ -52,33 +36,35 @@ jobs:
token: ${{ secrets.GH_REPO_TOKEN }}
fetch-depth: 0

- uses: ./.github/actions/build
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build'
shell: bash
# language=sh
run: |
nx run-many \
--runner="cloud" \
--output-style="static" \
--target="build"
- uses: actions/upload-pages-artifact@v1
with:
path: dist

- uses: myparcelnl/actions/semantic-release@v3
with:
token: ${{ secrets.GH_REPO_TOKEN }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# TODO implement release flow with monodeploy

deploy:
needs: release
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
# TODO: uncomment when on main
# deploy:
# needs: release
# runs-on: ubuntu-22.04
# permissions:
# pages: write
# id-token: write
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# steps:
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v1

rebase-prs:
needs: release
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: 'Run tests 🧪'

on:
pull_request:
branches:
- main
- beta
- alpha

paths-ignore:
- ./**/*.md

merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit

typecheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: myparcelnl/actions/yarn-install@v3
with:
node-version: ${{ vars.NODE_VERSION }}

- name: 'Run typecheck'
# language=sh
run: |
nx run-many \
--runner="cloud" \
--output-style="static" \
--target="typecheck"
bundlewatch:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: myparcelnl/actions/yarn-install@v3
with:
node-version: ${{ vars.NODE_VERSION }}

- name: 'Build'
shell: bash
# language=sh
run: |
nx run-many \
--runner="cloud" \
--output-style="static" \
--target="build"
- uses: myparcelnl/actions/bundlewatch@v3
with:
token: ${{ secrets.BUNDLEWATCH_TOKEN }}
43 changes: 22 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
name: 'Run tests 🧪'
name: '🔸 Run tests 🧪'

on:
pull_request:
branches:
- main
- alpha
- beta

merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
workflow_call:

jobs:
test:
name: 'Run unit tests'
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [18, 20]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test
- uses: actions/checkout@v4

- uses: myparcelnl/actions/yarn-install@v3
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
node-version: ${{ matrix.node-version }}

build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: 'Run tests'
#language=sh
run: |
nx run-many \
--runner="cloud" \
--output-style="static" \
--target="test:coverage"
- uses: codecov/codecov-action@v3
if: matrix.node-version == vars.NODE_VERSION
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"runner": "nx-cloud",
"options": {
"parallel": 10,
"cacheableOperations": ["build", "test:coverage"],
"cacheableOperations": ["build", "test:coverage", "typecheck"],
"accessToken": "ZDk5NTE5ZWItMmYxYy00ZjNmLThjMzItMmM0MjIwZTU1M2Y3fHJlYWQtd3JpdGU="
}
}
Expand Down

0 comments on commit f1584bb

Please sign in to comment.