From bee8192399b08bb8baab4037e6de860500c6056d Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 22 Sep 2022 15:14:20 +0100 Subject: [PATCH 1/6] workflow: dogfood & tidy (#1165) * minify workflows, bump actions versions * dogfood * local install * remove unused `inputs.test` * drop {} Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com> --- .github/workflows/gitlab.yml | 9 +++------ .github/workflows/images.yml | 7 ++----- .github/workflows/release.yml | 20 +++++++++++--------- .github/workflows/test-deploy.yml | 12 ++++++------ .github/workflows/trigger-external.yml | 18 ++++++------------ 5 files changed, 28 insertions(+), 38 deletions(-) diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml index 62d77c5f7..fe0ee303d 100644 --- a/.github/workflows/gitlab.yml +++ b/.github/workflows/gitlab.yml @@ -6,8 +6,7 @@ jobs: services: gitlab: image: docker://gitlab/gitlab-ce - ports: - - 8000:8000 + ports: [8000:8000] env: GITLAB_OMNIBUS_CONFIG: | external_url 'http://localhost:8000/gitlab' @@ -21,8 +20,7 @@ jobs: } ' steps: - - name: Checkout repository - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure credentials run: | docker exec ${{ job.services.gitlab.id }} bin/gitlab-rails runner " @@ -60,8 +58,7 @@ jobs: --request GET \ | jq -r .id \ | xargs -0 printf "::set-output name=hash::%s" - - name: Install dependencies - run: npm ci + - run: npm ci - name: Run cml-send-comment run: | node bin/cml.js send-comment \ diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 1f8a8ac87..013dce265 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -1,9 +1,6 @@ on: workflow_call: inputs: - test: - required: false - type: boolean jobs: images: runs-on: ubuntu-latest @@ -27,7 +24,7 @@ jobs: base: 1 dvc: 2 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} fetch-depth: 0 @@ -73,7 +70,7 @@ jobs: )" echo ::set-output name=tags::"${TAGS//$'\n'/'%0A'}" - uses: docker/setup-buildx-action@v1 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f826cdfc..caecf47e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,23 +15,25 @@ jobs: if: github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - run: | - git config --global user.name Olivaw[bot] - git config --global user.email 64868532+iterative-olivaw@users.noreply.github.com + - uses: actions/checkout@v3 + - name: Bump version + run: | + npm install -g . + cml ci git checkout -b bump/$(npm version ${{ github.event.inputs.bump }}) + - name: Create PR + run: | git push --set-upstream origin --follow-tags HEAD - gh pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖" - gh pr merge --squash --auto + cml pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖" --squash env: GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} release: if: github.event.pull_request.merged && startsWith(github.head_ref, 'bump/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: - gh release create --generate-notes {--title=CML\ ,}$(basename ${{ - github.head_ref }}) + gh release create --draft --generate-notes {--title=CML\ ,}$(basename + ${{ github.head_ref }}) env: GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 52c543c0d..f81ff4a72 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -22,13 +22,13 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - - name: check that npm lock file is on version 2 + - name: npm lock file is v2 run: jq --exit-status .lockfileVersion==2 < package-lock.json lint: needs: authorize runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - uses: actions/setup-node@v2 @@ -38,7 +38,7 @@ jobs: needs: authorize runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - uses: actions/setup-node@v2 @@ -69,7 +69,7 @@ jobs: system: [ubuntu, macos, windows] runs-on: ${{ matrix.system }}-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - if: matrix.system == 'windows' @@ -91,7 +91,7 @@ jobs: needs: [lint, test, test-os] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - uses: actions/setup-node@v2 @@ -106,7 +106,7 @@ jobs: - name: install ldid run: | sudo apt install --yes libplist-dev - git clone --branch v2.1.5 git://git.saurik.com/ldid.git + git clone --branch v2.1.5 git://git.saurik.com/ldid.git sudo g++ -pipe -o /usr/bin/ldid ldid/ldid.cpp -I. -x c ldid/{lookup2.c,sha1.h} -lplist -lcrypto - id: build name: build diff --git a/.github/workflows/trigger-external.yml b/.github/workflows/trigger-external.yml index 15b39e5de..5ce0c1eb3 100644 --- a/.github/workflows/trigger-external.yml +++ b/.github/workflows/trigger-external.yml @@ -7,24 +7,20 @@ on: type: string required: true release: - types: - - published + types: [published] pull_request: - branches: - - master + branches: [master] jobs: pr: if: ${{ github.event_name == 'pull_request' }} runs-on: ubuntu-latest strategy: matrix: - repos: - - cml-playground + repos: [cml-playground] steps: - name: Trigger external actions run: | - curl --silent --show-error \ - --request POST \ + curl --silent --show-error --request POST \ --header "Authorization: token ${{ secrets.TEST_GITHUB_TOKEN }}" \ --header "Accept: application/vnd.github.v3+json" \ --url "https://api.github.com/repos/iterative/${{ matrix.repos }}/dispatches" \ @@ -36,13 +32,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - repos: - - cml-playground + repos: [cml-playground] steps: - name: Trigger external actions run: | - curl --silent --show-error \ - --request POST \ + curl --silent --show-error --request POST \ --header "Authorization: token ${{ secrets.TEST_GITHUB_TOKEN }}" \ --header "Accept: application/vnd.github.v3+json" \ --url "https://api.github.com/repos/iterative/${{ matrix.repos }}/dispatches" \ From cb8c8823e26846533178309ae15f6ff720f547bc Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Thu, 22 Sep 2022 18:52:40 +0200 Subject: [PATCH 2/6] Fix release workflow (#1181) * Revert dogfood * Dummy commit to trigger tests * Fix workflow call --- .github/workflows/images.yml | 4 +--- .github/workflows/release.yml | 13 ++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 013dce265..b885a6c88 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -1,6 +1,4 @@ -on: - workflow_call: - inputs: +on: workflow_call jobs: images: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index caecf47e0..a6db1a027 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,15 +16,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Bump version - run: | - npm install -g . - cml ci + - run: npm ci && npm install --global + - run: | + git config --global user.name Olivaw[bot] + git config --global user.email 64868532+iterative-olivaw@users.noreply.github.com git checkout -b bump/$(npm version ${{ github.event.inputs.bump }}) - - name: Create PR - run: | git push --set-upstream origin --follow-tags HEAD - cml pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖" --squash + gh pr create --title "Bump version to $(git describe --tags)" --body "Approve me 🤖" + gh pr merge --auto --squash env: GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} release: From 2607964112e20d7e1ca599f9bd032054ad3b3fea Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Thu, 22 Sep 2022 18:58:04 +0200 Subject: [PATCH 3/6] Remove stray `npm install` (#1183) --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6db1a027..a0c415c37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: npm ci && npm install --global - run: | git config --global user.name Olivaw[bot] git config --global user.email 64868532+iterative-olivaw@users.noreply.github.com From 21e417ca89c5d8e742523acb06daa1af975601e4 Mon Sep 17 00:00:00 2001 From: "Olivaw[bot]" <64868532+iterative-olivaw@users.noreply.github.com> Date: Thu, 22 Sep 2022 19:00:55 +0200 Subject: [PATCH 4/6] 0.18.0 (#1182) Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com> --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c45035e2..00cbfac26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dvcorg/cml", - "version": "0.17.3", + "version": "0.18.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@dvcorg/cml", - "version": "0.17.3", + "version": "0.18.0", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.9.1", diff --git a/package.json b/package.json index f1a2afa4b..2ca9f2339 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dvcorg/cml", - "version": "0.17.3", + "version": "0.18.0", "description": "

", "author": { "name": "Iterative Inc", From 6c0e582934508951c64cc0d534030440c9f045c2 Mon Sep 17 00:00:00 2001 From: Domas Monkus Date: Mon, 26 Sep 2022 11:31:27 +0300 Subject: [PATCH 5/6] Defining port mappings without quotes is ambiguous yaml syntax. --- .github/workflows/gitlab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitlab.yml b/.github/workflows/gitlab.yml index fe0ee303d..c85cfd065 100644 --- a/.github/workflows/gitlab.yml +++ b/.github/workflows/gitlab.yml @@ -6,7 +6,7 @@ jobs: services: gitlab: image: docker://gitlab/gitlab-ce - ports: [8000:8000] + ports: ['8000:8000'] env: GITLAB_OMNIBUS_CONFIG: | external_url 'http://localhost:8000/gitlab' From c1bc4f5c431b69bdb3d386012278f4f477843cbb Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Thu, 29 Sep 2022 00:09:43 +0200 Subject: [PATCH 6/6] Fix release process, again (#1188) * Update test-deploy.yml * Update release.yml --- .github/workflows/release.yml | 4 ++++ .github/workflows/test-deploy.yml | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0c415c37..32b18cd03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,3 +35,7 @@ jobs: ${{ github.head_ref }}) env: GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} + package: + needs: release + secrets: inherit + uses: ./.github/workflows/test-deploy.yml diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index f81ff4a72..ef3d0a0e9 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -1,11 +1,10 @@ name: Test & Deploy on: - schedule: - - cron: '0 8 * * 1' # M H d m w (Mondays at 8:00) - release: - types: [created] pull_request_target: workflow_dispatch: + workflow_call: + schedule: + - cron: '0 8 * * 1' # M H d m w (Mondays at 8:00) jobs: authorize: environment: @@ -99,7 +98,7 @@ jobs: registry-url: https://registry.npmjs.org - run: npm install - run: - npm ${{ github.event_name == 'release' && 'publish' || 'publish + npm ${{ github.event_name == 'workflow_call' && 'publish' || 'publish --dry-run' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -121,7 +120,7 @@ jobs: cp build/cml-linux{-x64,} cp build/cml-macos{-x64,} - uses: softprops/action-gh-release@v1 - if: github.event_name == 'release' + if: github.event_name == 'workflow_call' with: files: | build/cml-alpine-arm64