Skip to content

Commit

Permalink
Update deps (#50)
Browse files Browse the repository at this point in the history
* Update deps

* Bump version

* Switch ipfs test commands to ipv4 localhost

* Update tests and remove node-fetch

* Add renovate

* Update docker workflow so we test it builds

* Add back in packages for arm64
  • Loading branch information
mattdean-digicatapult authored Mar 3, 2023
1 parent c3d5a3a commit 0b7612c
Show file tree
Hide file tree
Showing 21 changed files with 927 additions and 1,637 deletions.
114 changes: 8 additions & 106 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,101 +29,13 @@ jobs:
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT
echo "ORG_NAME=$ORG_NAME" >> $GITHUB_OUTPUT
helm-lint:
runs-on: ubuntu-latest
needs: [preconditions]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint --validate-maintainers false --charts helm/${{ needs.preconditions.outputs.repo_name }}/ --chart-repos dscp-node=https://digicatapult.github.io/dscp-node/

helm-test:
runs-on: ubuntu-latest
needs: [preconditions]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: '--debug'
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.17.1'
kubernetes version: 'v1.19.2'
- name: Login to minikube docker registry
run: eval $(minikube -p minikube docker-env)
- name: Build Multi-arch
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
load: false
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
tags: |
${{ needs.preconditions.outputs.repo_name }}:latest
labels: |
org.opencontainers.image.title=${{ needs.preconditions.outputs.repo_name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Load and push image for testing
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
load: true
file: ./Dockerfile
platforms: linux/amd64
tags: |
${{ needs.preconditions.outputs.repo_name }}:latest
labels: |
org.opencontainers.image.title=${{ needs.preconditions.outputs.repo_name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Run chart-testing (install)
run: ct install --charts helm/${{ needs.preconditions.outputs.repo_name }}/ --chart-repos dscp-node=https://digicatapult.github.io/dscp-node/

lint:
name: Run lint
runs-on: ubuntu-latest
needs: [preconditions]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Use npm v8
Expand All @@ -148,9 +60,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Use npm v8
run: npm install -g npm@8
node-version: 18.x
- name: Use npm latest
run: npm install -g npm@latest
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand All @@ -171,9 +83,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Use npm v8
run: npm install -g npm@8
node-version: 18.x
- name: Use npm latest
run: npm install -g npm@latest
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -220,8 +132,6 @@ jobs:
name: 'Publish package'
needs:
- preconditions
- helm-lint
- helm-test
- lint
- dependency-check
- tests
Expand Down Expand Up @@ -254,7 +164,7 @@ jobs:
username: ${{ secrets.DSCP_DOCKERHUB_USERNAME }}
password: ${{ secrets.DSCP_DOCKERHUB_TOKEN }}
- name: Publish multi-arch image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
Expand All @@ -275,14 +185,6 @@ jobs:
org.opencontainers.image.version=${{ needs.check-version.outputs.version }}
org.opencontainers.image.created=${{ needs.check-version.outputs.build_date }}
# Publish helm charts
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: helm
helm_version: 3.8.0

# Build github release
- name: Build release version
uses: softprops/action-gh-release@v1
Expand Down
135 changes: 39 additions & 96 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,104 +23,16 @@ jobs:
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT
echo "ORG_NAME=$ORG_NAME" >> $GITHUB_OUTPUT
helm-lint:
runs-on: ubuntu-latest
needs: [repo_ids]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint --validate-maintainers false --charts helm/${{ needs.repo_ids.outputs.repo_name }}/ --chart-repos dscp-node=https://digicatapult.github.io/dscp-node/

helm-test:
runs-on: ubuntu-latest
needs: [repo_ids]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: '--debug'
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.17.1'
kubernetes version: 'v1.19.2'
- name: Login to minikube docker registry
run: eval $(minikube -p minikube docker-env)
- name: Build Multi-arch
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
load: false
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
tags: |
${{ needs.repo_ids.outputs.repo_name }}:latest
labels: |
org.opencontainers.image.title=${{ needs.repo_ids.outputs.repo_name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Load and push image for testing
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
load: true
file: ./Dockerfile
platforms: linux/amd64
tags: |
${{ needs.repo_ids.outputs.repo_name }}:latest
labels: |
org.opencontainers.image.title=${{ needs.repo_ids.outputs.repo_name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Run chart-testing (install)
run: ct install --charts helm/${{ needs.repo_ids.outputs.repo_name }}/ --chart-repos dscp-node=https://digicatapult.github.io/dscp-node/

lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Use npm v8
run: npm install -g npm@8
node-version: 18.x
- name: Use npm latest
run: npm install -g npm@latest
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand All @@ -140,9 +52,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Use npm v8
run: npm install -g npm@8
node-version: 18.x
- name: Use npm latest
run: npm install -g npm@latest
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand All @@ -163,8 +75,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 16.x
- name: Use npm v8
node-version: 18.x
- name: Use npm latest
run: npm install -g npm@8
- name: Cache Node.js modules
uses: actions/cache@v3
Expand Down Expand Up @@ -202,3 +114,34 @@ jobs:
shell: bash
run: |
exit $([[ "${{steps.get_version.outputs.IS_NEW_VERSION}}" = "true" ]] && echo 0 || echo 1)
docker-build:
name: 'Build docker image'
needs:
- lint
- tests
- check-version
- dependency-check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Docker build
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: '--debug'
- name: Publish multi-arch image
uses: docker/build-push-action@v4
with:
push: false
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# syntax=docker/dockerfile:1.3-labs
# syntax=docker/dockerfile:1.5

ARG IPFS_BUILD_IMAGE_VERSION=1.19.2-alpine3.15
ARG NODE_RUNTIME_IMAGE_VERSION=16-alpine
ARG IPFS_BUILD_IMAGE_VERSION=1.19-alpine3.17
ARG NODE_RUNTIME_IMAGE_VERSION=lts-alpine3.17
FROM golang:$IPFS_BUILD_IMAGE_VERSION AS ipfs_build

ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache binutils-gold; fi

RUN apk add --no-cache git make bash gcc musl-dev

WORKDIR /target

ARG IPFS_TAG="v0.16.0"
ARG IPFS_TAG="v0.18.1"

RUN <<EOF
set -ex
Expand All @@ -26,7 +27,7 @@ FROM node:$NODE_RUNTIME_IMAGE_VERSION AS runtime
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache python3 make g++; fi
RUN apk add --no-cache curl
RUN npm i -g npm@8.x.x
RUN npm i -g npm@latest

ARG LOGLEVEL
ENV NPM_CONFIG_LOGLEVEL ${LOGLEVEL}
Expand Down
2 changes: 1 addition & 1 deletion app/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const vars = envalid.cleanEnv(
LOG_LEVEL: envalid.str({ default: 'info', devDefault: 'debug' }),
PORT: envalid.port({ default: 80, devDefault: 3000 }),
NODE_HOST: envalid.host({ devDefault: 'localhost' }),
IPFS_API_HOST: envalid.host({ devDefault: 'localhost' }),
IPFS_API_HOST: envalid.host({ default: 'localhost' }),
IPFS_API_PORT: envalid.port({ default: 5001 }),
NODE_PORT: envalid.port({ default: 9944 }),
IPFS_PATH: envalid.str({ default: '/ipfs', devDefault: path.resolve(__dirname, '..', `data`) }),
Expand Down
6 changes: 0 additions & 6 deletions helm/dscp-ipfs/Chart.lock

This file was deleted.

16 changes: 0 additions & 16 deletions helm/dscp-ipfs/Chart.yaml

This file was deleted.

Loading

0 comments on commit 0b7612c

Please sign in to comment.