Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
118 changes: 14 additions & 104 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Main CI

on:
push:
branches: ['main', 'next']
branches: ["main", "next"]
pull_request:
types: [opened, synchronize, reopened]

Expand All @@ -15,42 +15,23 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
package_json_file: 'package.json'
package_json_file: "package.json"
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- run: pnpm i --frozen-lockfile && pnpm run build
node-version: "20"
cache: "pnpm"
- name: Install next dependencies
run: cd next && pnpm i --frozen-lockfile
- name: Install legacy dependencies
run: cd legacy && pnpm i --frozen-lockfile
- name: Build global app
run: pnpm build
- uses: actions/upload-artifact@v4
with:
name: pogues
path: dist

build-next:
runs-on: ubuntu-latest
if: github.event.head_commit.author.name != 'github-actions[bot]'
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
package_json_file: 'next/package.json'
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: next/pnpm-lock.yaml
- run: cd next && pnpm i --frozen-lockfile && pnpm run build
- uses: actions/upload-artifact@v4
with:
name: pogues-next
path: next/dist

check_if_version_upgraded:
needs: ['build', 'build-next']
needs: ["build"]
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
Expand All @@ -59,32 +40,18 @@ jobs:
version: ${{ steps.version.outputs.prop }}
is_version_changed: ${{ steps.check.outputs.exists == 'false' }}
is_pre_release: ${{ contains(steps.version.outputs.prop, '-rc' ) }}
next_version: ${{ steps.next_version.outputs.prop }}
next_is_version_changed: ${{ steps.next_check.outputs.exists == 'false' }}
next_is_pre_release: ${{ contains(steps.next_version.outputs.prop, '-rc' ) }}
steps:
- uses: actions/checkout@v4
- id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'package.json'
prop_path: 'version'
path: "package.json"
prop_path: "version"
## we check if repo contains already this tag, if not version, has changed
- uses: mukunku/tag-exists-action@v1.6.0
id: check
with:
tag: ${{ steps.version.outputs.prop }}
- uses: actions/checkout@v4
- id: next_version
uses: notiz-dev/github-action-json-property@release
with:
path: 'next/package.json'
prop_path: 'version'
## we check if repo contains already this tag, if not version, has changed
- uses: mukunku/tag-exists-action@v1.6.0
id: next_check
with:
tag: ${{ steps.next_version.outputs.prop }}

docker_pogues:
needs: check_if_version_upgraded
Expand All @@ -107,39 +74,12 @@ jobs:
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: '.'
context: "."
push: true
tags: |
inseefr/pogues:latest,
inseefr/pogues:${{ needs.check_if_version_upgraded.outputs.version }}

docker_pogues_next:
needs: check_if_version_upgraded
if: |
(github.event_name == 'push' || needs.check_if_version_upgraded.outputs.next_is_pre_release == 'true') &&
needs.check_if_version_upgraded.outputs.next_is_version_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: pogues-next
path: next/dist
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: './next'
push: true
tags: |
inseefr/pogues:latest,
inseefr/pogues:${{ needs.check_if_version_upgraded.outputs.next_version }}

release:
runs-on: ubuntu-latest
needs: check_if_version_upgraded
Expand Down Expand Up @@ -169,33 +109,3 @@ jobs:
files: ./pogues.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release_next:
runs-on: ubuntu-latest
needs: check_if_version_upgraded
# We create release only if the version in the package.json have been upgraded and this CI is running against the main branch.
# We allow branches with a PR open on main to publish pre-release (x.y.z-rc.u) but not actual releases.
if: |
(github.event_name == 'push' || needs.check_if_version_upgraded.outputs.next_is_pre_release == 'true') &&
needs.check_if_version_upgraded.outputs.next_is_version_changed == 'true'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/download-artifact@v4
with:
name: pogues-next
path: next/dist
- name: Zip bundle
run: cd next/dist && zip -r ../pogues.zip ./*
- uses: softprops/action-gh-release@v2
with:
name: Release ${{ needs.check_if_version_upgraded.outputs.next_version }}
tag_name: ${{ needs.check_if_version_upgraded.outputs.next_version }}
target_commitish: ${{ github.head_ref || github.ref }}
generate_release_notes: true
draft: false
prerelease: ${{ needs.check_if_version_upgraded.outputs.next_is_pre_release == 'true' }}
files: ./next/pogues.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 15 additions & 13 deletions .github/workflows/test.yaml → .github/workflows/test-legacy.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: Pogues Test CI
name: Pogues Test CI for Legacy

on:
push:
branches: ['main', 'next']
paths-ignore: ['next/**']
branches: ["main", "next"]
paths: ["legacy/**"]
pull_request:
types: [opened, synchronize, reopened]
paths-ignore: ['next/**']
paths: ["legacy/**"]

jobs:
test:
name: Test
name: Test Legacy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
package_json_file: 'package.json'
package_json_file: "legacy/package.json"
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- run: pnpm i --frozen-lockfile && pnpm test:coverage
node-version: "20"
cache: "pnpm"
cache-dependency-path: legacy/pnpm-lock.yaml
- run: cd legacy && pnpm i --frozen-lockfile && pnpm test:coverage
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
path: legacy/coverage

sonarcloud:
name: SonarCloud
name: SonarCloud Legacy
runs-on: ubuntu-latest
needs: test
steps:
Expand All @@ -43,9 +43,11 @@ jobs:
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage
path: legacy/coverage
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
with:
projectBaseDir: legacy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
42 changes: 1 addition & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,2 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
selenium-debug.log

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.__mf__temp

# Testing
coverage


build/

deploy-auth.json
_book
*.iml
screenshots/
docs/stats.html
reports*
.history/*
.history*
package-lock.json
dist
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm test
Loading
Loading