From fbdd629411fcc1085e2dc49cb57fbdca0f8de025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 14:55:16 +0200 Subject: [PATCH 01/16] release packaging attempt --- .github/workflows/releases.yml | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..cf439ca --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,97 @@ +name: MonarcAppFO releases + +on: + push: + branches: [ 'ci-releases' ] + tags: [ 'v*.*', 'v*.*.*', 'v*.*.*-*' ] + pull_request: + branches: [ 'master' ] + +jobs: + build: + runs-on: ubuntu-20.04 + + strategy: + matrix: + node-version: [ "16.x" ] + php-version: [ "7.4" ] + + steps: + - uses: actions/checkout@v2 + + # PHP + #- name: Cache Composer dependencies + # uses: actions/cache@v2 + # with: + # path: /tmp/composer-cache + # key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + + - name: Install dependencies + uses: php-actions/composer@v6 + with: + php_version: ${{ matrix.php-version }} + php_extensions: json pdo bcmath + version: 2.3.x + + - name: Symlink Monarc modules + run: | + mkdir -p module/Monarc + ln -s ../../vendor/monarc/core module/Monarc/Core + ln -s ../../vendor/monarc/frontoffice module/Monarc/FrontOffice + + # javascript + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Prepare node_modules + run: | + mkdir -p node_modules + + # ng_anr + - name: Clone ng_anr + uses: actions/checkout@v2 + with: + repository: monarc-project/ng-anr + path: node_modules/ng_anr + + - name: checkout latest tag + run: | + git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" + working-directory: node_modules/ng_anr + + - name: Install ng_anr + run: | + npm ci + working-directory: node_modules/ng_anr + + # ng_client + - name: Clone ng_client + uses: actions/checkout@v2 + with: + repository: monarc-project/ng-client + path: node_modules/ng_client + + - name: checkout latest tag + run: | + git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" + working-directory: node_modules/ng_client + + - name: Install ng_client + run: | + npm ci + working-directory: node_modules/ng_client + + # rest of javascript deps + - name: Install grunt + run: npm install -g grunt-cli + + - name: Install dependencies + run: npm install + + # final "cleanup" + - name: post job + run: | + ./scripts/link_modules_resources.sh + ./scripts/compile_translations.sh From 1d1e4edf0718acbf5ec5a4fa845c3446f16f29a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 14:59:37 +0200 Subject: [PATCH 02/16] lets try without extension --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index cf439ca..f47405a 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -30,7 +30,7 @@ jobs: uses: php-actions/composer@v6 with: php_version: ${{ matrix.php-version }} - php_extensions: json pdo bcmath + # php_extensions: json pdo bcmath version: 2.3.x - name: Symlink Monarc modules From 5ef86725b84a1303424aaba9ac461a5049e2c831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:04:01 +0200 Subject: [PATCH 03/16] need arg to be set --- .github/workflows/releases.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index f47405a..8463948 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -30,6 +30,7 @@ jobs: uses: php-actions/composer@v6 with: php_version: ${{ matrix.php-version }} + command: install # php_extensions: json pdo bcmath version: 2.3.x From b728c2ee7194a0754f0eeff5541252f78335e2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:07:47 +0200 Subject: [PATCH 04/16] use origin php setup action --- .github/workflows/releases.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8463948..b2b5ffa 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -20,19 +20,18 @@ jobs: - uses: actions/checkout@v2 # PHP - #- name: Cache Composer dependencies - # uses: actions/cache@v2 - # with: - # path: /tmp/composer-cache - # key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} - - - name: Install dependencies - uses: php-actions/composer@v6 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - php_version: ${{ matrix.php-version }} - command: install - # php_extensions: json pdo bcmath - version: 2.3.x + php-version: ${{ matrix.php-version }} + tools: composer:v2.3 + extensions: bcmath + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install PHP dependencies + run: composer install --prefer-dist --no-progress --no-suggest - name: Symlink Monarc modules run: | From 23d460771d21a458d2720f7bdd8813bbd5017191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:09:45 +0200 Subject: [PATCH 05/16] fetch tags --- .github/workflows/{php.yml => php.yml.disabled} | 0 .github/workflows/releases.yml | 2 ++ 2 files changed, 2 insertions(+) rename .github/workflows/{php.yml => php.yml.disabled} (100%) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml.disabled similarity index 100% rename from .github/workflows/php.yml rename to .github/workflows/php.yml.disabled diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index b2b5ffa..e65de22 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -58,6 +58,7 @@ jobs: - name: checkout latest tag run: | + git fetch --tags git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" working-directory: node_modules/ng_anr @@ -75,6 +76,7 @@ jobs: - name: checkout latest tag run: | + git fetch --tags git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" working-directory: node_modules/ng_client From 973e51933c813c73968f6766fe69d09eba8887ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:11:51 +0200 Subject: [PATCH 06/16] npm madness --- .github/workflows/releases.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index e65de22..6b218e8 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -63,8 +63,9 @@ jobs: working-directory: node_modules/ng_anr - name: Install ng_anr + # no package-lock.json in ng_anr run: | - npm ci + npm install working-directory: node_modules/ng_anr # ng_client @@ -81,6 +82,7 @@ jobs: working-directory: node_modules/ng_client - name: Install ng_client + # this one has a package-lock.json run: | npm ci working-directory: node_modules/ng_client From 596f74e03ad15b2ede3a0ac1aee38bb2e7087957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:15:09 +0200 Subject: [PATCH 07/16] missing gettext for post tasks --- .github/workflows/releases.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 6b218e8..b150801 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -19,6 +19,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install deps + run: apt install -y gettext + # PHP - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -97,5 +100,5 @@ jobs: # final "cleanup" - name: post job run: | - ./scripts/link_modules_resources.sh - ./scripts/compile_translations.sh + bash -xe ./scripts/link_modules_resources.sh + bash -xe ./scripts/compile_translations.sh From 13a656617f5e7db615990472cb9b2976dd3db159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:16:00 +0200 Subject: [PATCH 08/16] sudo missing --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index b150801..a5da746 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - name: install deps - run: apt install -y gettext + run: sudo apt-get update && sudo apt install -y gettext # PHP - name: Setup PHP From 76d3d73815d8f38b43539d49cae8053991053911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:25:59 +0200 Subject: [PATCH 09/16] let's ignore error for the moment --- .github/workflows/releases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index a5da746..5601b75 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -100,5 +100,5 @@ jobs: # final "cleanup" - name: post job run: | - bash -xe ./scripts/link_modules_resources.sh - bash -xe ./scripts/compile_translations.sh + bash -x ./scripts/link_modules_resources.sh + bash -x ./scripts/compile_translations.sh From 907cbc0a28e88a29686ec87cdc98f9938703d405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:31:37 +0200 Subject: [PATCH 10/16] let's try to build tar.gz first --- .github/workflows/releases.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 5601b75..54c6df5 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -102,3 +102,20 @@ jobs: run: | bash -x ./scripts/link_modules_resources.sh bash -x ./scripts/compile_translations.sh + + # prepare release + - name: Get repository name + id: repository + run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-${{ env.COMPONENT }}-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.]/_/g')" + + - name: create artifact archive + run: | + tar --exclude .git --exclude .github -zcf '${{ steps.repository.outputs.pathref }}.tar.gz' . + + - name: release + uses: softprops/action-gh-release@v1 + with: + files: | + ${{ env.COMPONENT }}/${{ steps.repository.outputs.pathref }}.tar.gz + fail_on_unmatched_files: true + if: startsWith(github.ref, 'refs/tags/') From 4c0a19bef71f1f0e729ba8e3e7b5a3e993e8a748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:33:53 +0200 Subject: [PATCH 11/16] full pipeline run test --- .github/workflows/releases.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 54c6df5..fbd07b1 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -106,16 +106,16 @@ jobs: # prepare release - name: Get repository name id: repository - run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-${{ env.COMPONENT }}-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.]/_/g')" + run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.]/_/g')" - name: create artifact archive run: | - tar --exclude .git --exclude .github -zcf '${{ steps.repository.outputs.pathref }}.tar.gz' . + tar --exclude .git --exclude .github -zcf '../${{ steps.repository.outputs.pathref }}.tar.gz' . - name: release uses: softprops/action-gh-release@v1 with: files: | - ${{ env.COMPONENT }}/${{ steps.repository.outputs.pathref }}.tar.gz + ../${{ steps.repository.outputs.pathref }}.tar.gz fail_on_unmatched_files: true if: startsWith(github.ref, 'refs/tags/') From 45b1a8f9ff5b5bc27b3ac679fd0269586aa36f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:45:38 +0200 Subject: [PATCH 12/16] checking ng_client checkout mechanism --- .github/workflows/releases.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index fbd07b1..f6823bb 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -80,14 +80,18 @@ jobs: - name: checkout latest tag run: | + head src/ClientApp.js git fetch --tags git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" + head src/ClientApp.js working-directory: node_modules/ng_client - name: Install ng_client # this one has a package-lock.json run: | + head src/ClientApp.js npm ci + head src/ClientApp.js working-directory: node_modules/ng_client # rest of javascript deps @@ -95,7 +99,10 @@ jobs: run: npm install -g grunt-cli - name: Install dependencies - run: npm install + run: | + head node_modules/ng_client/src/ClientApp.js + npm install + head node_modules/ng_client/src/ClientApp.js # final "cleanup" - name: post job From bb1fd6899409782b5d0a1daeb71ce744490cc456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 15:51:05 +0200 Subject: [PATCH 13/16] using tagged version in package.json --- .github/workflows/releases.yml | 51 ---------------------------------- package.json | 4 +-- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index f6823bb..7926596 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -48,59 +48,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Prepare node_modules - run: | - mkdir -p node_modules - - # ng_anr - - name: Clone ng_anr - uses: actions/checkout@v2 - with: - repository: monarc-project/ng-anr - path: node_modules/ng_anr - - - name: checkout latest tag - run: | - git fetch --tags - git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" - working-directory: node_modules/ng_anr - - - name: Install ng_anr - # no package-lock.json in ng_anr - run: | - npm install - working-directory: node_modules/ng_anr - - # ng_client - - name: Clone ng_client - uses: actions/checkout@v2 - with: - repository: monarc-project/ng-client - path: node_modules/ng_client - - - name: checkout latest tag - run: | - head src/ClientApp.js - git fetch --tags - git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))" - head src/ClientApp.js - working-directory: node_modules/ng_client - - - name: Install ng_client - # this one has a package-lock.json - run: | - head src/ClientApp.js - npm ci - head src/ClientApp.js - working-directory: node_modules/ng_client - - # rest of javascript deps - - name: Install grunt - run: npm install -g grunt-cli - - name: Install dependencies run: | - head node_modules/ng_client/src/ClientApp.js npm install head node_modules/ng_client/src/ClientApp.js diff --git a/package.json b/package.json index 895c58c..9875c41 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "author": "CASES", "license": "GNU Affero General Public License version 3", "dependencies": { - "ng_anr": "git+https://github.com/monarc-project/ng-anr.git#master", - "ng_client": "git+https://github.com/monarc-project/ng-client.git#master" + "ng_anr": "git+https://github.com/monarc-project/ng-anr.git#v2.11.1-p5", + "ng_client": "git+https://github.com/monarc-project/ng-client.git#v2.11.1-p7" }, "devDependencies": { "grunt": "~1.5.2", From 061718bb43d647a4d82c3658e4be4d8bb7ddc57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 16:28:04 +0200 Subject: [PATCH 14/16] trying will full error handling --- .github/workflows/releases.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 7926596..8496684 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -53,11 +53,21 @@ jobs: npm install head node_modules/ng_client/src/ClientApp.js + - name: Install ng-anr dependencies + run: | + npm install + working-direcory: node_modules/ng_anr/ + + - name: Install ng-client dependencies + run: | + npm install + working-direcory: node_modules/ng_client/ + # final "cleanup" - name: post job run: | - bash -x ./scripts/link_modules_resources.sh - bash -x ./scripts/compile_translations.sh + bash -ex ./scripts/link_modules_resources.sh + bash -ex ./scripts/compile_translations.sh # prepare release - name: Get repository name From 6dcda5c83290543eadc061c304e9ba4d94901137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Mon, 30 May 2022 16:28:40 +0200 Subject: [PATCH 15/16] fixing typo --- .github/workflows/releases.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8496684..34e1808 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -56,12 +56,12 @@ jobs: - name: Install ng-anr dependencies run: | npm install - working-direcory: node_modules/ng_anr/ + working-directory: node_modules/ng_anr/ - name: Install ng-client dependencies run: | npm install - working-direcory: node_modules/ng_client/ + working-directory: node_modules/ng_client/ # final "cleanup" - name: post job From 7d141347108af104884580c96bcf6db8315238ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Laurent?= Date: Tue, 31 May 2022 11:28:14 +0200 Subject: [PATCH 16/16] release pipeline working, ready to merge --- .github/workflows/{php.yml.disabled => php.yml} | 0 .github/workflows/releases.yml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{php.yml.disabled => php.yml} (100%) diff --git a/.github/workflows/php.yml.disabled b/.github/workflows/php.yml similarity index 100% rename from .github/workflows/php.yml.disabled rename to .github/workflows/php.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 34e1808..4adeea5 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -2,7 +2,7 @@ name: MonarcAppFO releases on: push: - branches: [ 'ci-releases' ] + branches: [ 'master' ] tags: [ 'v*.*', 'v*.*.*', 'v*.*.*-*' ] pull_request: branches: [ 'master' ] @@ -72,7 +72,7 @@ jobs: # prepare release - name: Get repository name id: repository - run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.]/_/g')" + run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.-]/_/g')" - name: create artifact archive run: |