Update mirror #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sdk CI | |
on: push | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
name: Filter commit changes | |
outputs: | |
sdk: ${{ steps.filter.outputs.sdk }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Filter commit changes | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
list-files: "json" | |
filters: | | |
sdk: | |
- 'sdk/**' | |
- '.github/workflows/sdk.yml' | |
- '.github/workflows/reuse-*.yml' | |
store_image_name_and_tags: | |
uses: ./.github/workflows/reuse-store-image-name-and-tags.yml | |
with: | |
image_name: consensys/linea-postman | |
check_image_tags_exist: | |
needs: [ changes, store_image_name_and_tags ] | |
if: ${{ needs.changes.outputs.sdk == 'false' }} | |
uses: ./.github/workflows/reuse-check-image-tags-exist.yml | |
with: | |
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }} | |
common_ancestor_tag: ${{ needs.store_image_name_and_tags.outputs.common_ancestor_tag }} | |
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }} | |
secrets: inherit | |
sdk-tag-only: | |
needs: [ changes, store_image_name_and_tags, check_image_tags_exist ] | |
if: ${{ needs.changes.outputs.sdk == 'false' }} | |
uses: ./.github/workflows/reuse-image-tag-push.yml | |
with: | |
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }} | |
last_commit_tag: ${{ needs.store_image_name_and_tags.outputs.last_commit_tag }} | |
common_ancestor_tag: ${{ needs.store_image_name_and_tags.outputs.common_ancestor_tag }} | |
develop_tag: ${{ needs.store_image_name_and_tags.outputs.develop_tag }} | |
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }} | |
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }} | |
last_commit_tag_exists: ${{ needs.check_image_tags_exist.outputs.last_commit_tag_exists }} | |
common_ancestor_commit_tag_exists: ${{ needs.check_image_tags_exist.outputs.common_ancestor_commit_tag_exists }} | |
secrets: inherit | |
run-tests: | |
needs: [ changes, store_image_name_and_tags, sdk-tag-only ] | |
if: ${{ always() && (needs.changes.outputs.sdk == 'true' || needs.sdk-tag-only.result != 'success' || needs.sdk-tag-only.outputs.image_tagged != 'true') }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.15.0 | |
cache: 'pnpm' | |
- name: Npm install | |
run: pnpm i --frozen-lockfile --prefer-offline --ignore-scripts | |
- name: Run tests and generate coverage report | |
run: | | |
pnpm run -F ./sdk build; | |
pnpm run -F ./sdk test; | |
build-and-publish: | |
needs: [ changes, store_image_name_and_tags, sdk-tag-only ] | |
if: ${{ always() && (needs.changes.outputs.sdk == 'true' || needs.sdk-tag-only.result != 'success' || needs.sdk-tag-only.outputs.image_tagged != 'true') }} | |
runs-on: ubuntu-22.04 | |
env: | |
COMMIT_TAG: ${{ needs.store_image_name_and_tags.outputs.commit_tag }} | |
DEVELOP_TAG: ${{ needs.store_image_name_and_tags.outputs.develop_tag }} | |
UNTESTED_TAG_SUFFIX: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }} | |
IMAGE_NAME: ${{ needs.store_image_name_and_tags.outputs.image_name }} | |
name: Postman build and push | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ssh-key: ${{ secrets.SELF_GITHUB_SSH_KEY }} | |
submodules: true | |
persist-credentials: false | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Show the "version" build argument | |
run: | | |
echo "We inject the commit tag in the docker image ${{ env.COMMIT_TAG }}" | |
echo COMMIT_TAG=${{ env.COMMIT_TAG }} >> $GITHUB_ENV | |
- name: Build and push postman image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./sdk/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:${{ env.COMMIT_TAG }}-${{ env.UNTESTED_TAG_SUFFIX }} | |
run-e2e-tests: | |
needs: [ changes, store_image_name_and_tags, build-and-publish ] | |
if: ${{ always() && (needs.changes.outputs.coordinator == 'true' || needs.build-and-publish.result == 'success') }} | |
uses: ./.github/workflows/reuse-run-e2e-tests.yml | |
with: | |
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }} | |
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }} | |
secrets: inherit | |
tag-after-run-tests-success: | |
needs: [ store_image_name_and_tags, run-tests, run-e2e-tests ] | |
if: ${{ always() && needs.run-tests.result == 'success' && needs.run-e2e-tests.outputs.tests_outcome == 'success' }} | |
uses: ./.github/workflows/reuse-tag-without-untested-suffix.yml | |
with: | |
commit_tag: ${{ needs.store_image_name_and_tags.outputs.commit_tag }} | |
develop_tag: ${{ needs.store_image_name_and_tags.outputs.develop_tag }} | |
untested_tag_suffix: ${{ needs.store_image_name_and_tags.outputs.untested_tag_suffix }} | |
image_name: ${{ needs.store_image_name_and_tags.outputs.image_name }} | |
secrets: inherit |