Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix nx branch setup #84

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ runs:
- name: Read .nvmrc
shell: bash
id: nvm
run: echo "::set-output name=nvmrc::$(cat .nvmrc)"
run: echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.nvmrc }}
cache: npm

- name: Setup branch for NX
- name: Setup branch for NX (main)
shell: bash
if: github.ref == 'refs/head/main'
run: git branch -u origin/main main

- name: Setup branch for NX (!main)
shell: bash
if: github.ref != 'refs/head/main'
run: git branch --track main origin/main

- name: Install without scripts 🔧
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Read .nvmrc
id: nvm
run: echo ::set-output name=nvmrc::$(cat .nvmrc)
run: echo "nvmrc=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Setup Node.js
uses: actions/setup-node@v2
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ concurrency:
cancel-in-progress: true

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2

- uses: ./.github/setup

checks:
needs: [setup]
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -40,7 +31,6 @@ jobs:
OSSI_TOKEN: ${{ secrets.OSSI_TOKEN }}

test:
needs: [setup]
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -55,7 +45,7 @@ jobs:
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: junit/**/*.xml
files: coverage/**/*.junit.xml

release:
runs-on: ubuntu-latest
Expand All @@ -64,6 +54,8 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: ./.github/setup

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- uses: ./.github/setup

Expand Down
5 changes: 3 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
},
"targetDefaults": {
"build": {
"dependsOn": ["prepare", "^build"],
"inputs": ["default", "^default", "baseTypescript"]
"dependsOn": ["^build"],
"inputs": ["default", "^default", "baseTypescript"],
"outputs": ["{projectRoot}/dist"]
},
"test": {
"dependsOn": ["^test"],
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"executor": "@nx/vite:test",
"outputs": ["{workspaceRoot}/coverage/packages/eslint-plugin"],
"options": {
"coverage": true,
"reporters": ["junit"],
"passWithNoTests": true,
"reportsDirectory": "../../coverage/packages/eslint-plugin"
}
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default defineConfig({

test: {
globals: true,
outputFile: '../../coverage/packages/eslint-plugin/report.junit.xml',
cache: {
dir: '../../node_modules/.vitest',
},
Expand Down