Skip to content

Fix date arg for cache key. #906

Fix date arg for cache key.

Fix date arg for cache key. #906

name: Continuous Integration
on:
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]
tags: [ "*.*.*" ]
jobs:
# █████████ ███████████ ███ ████ █████
# ███░░░░░███ ░░███░░░░░███ ░░░ ░░███ ░░███
# ░███ ░░░ ██████ ████████ █████ █████ ██████ ████████ ░███ ░███ █████ ████ ████ ░███ ███████
# ░░█████████ ███░░███░░███░░███░░███ ░░███ ███░░███░░███░░███ ░██████████ ░░███ ░███ ░░███ ░███ ███░░███
# ░░░░░░░░███░███████ ░███ ░░░ ░███ ░███ ░███████ ░███ ░░░ ░███░░░░░███ ░███ ░███ ░███ ░███ ░███ ░███
# ███ ░███░███░░░ ░███ ░░███ ███ ░███░░░ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███
# ░░█████████ ░░██████ █████ ░░█████ ░░██████ █████ ███████████ ░░████████ █████ █████░░████████
# ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░
server_build:
strategy:
matrix:
os: [ubuntu-20.04]
arch: [amd64]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
with:
submodules: true
- name: ❄️ Install Nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: 💾 Cache Build
uses: cachix/cachix-action@v10
with:
name: cardano-ogmios
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: 🔨 Build
shell: bash
run: |
nix-build -A platform.amd64 -o dist
cp dist/bin/ogmios server/ogmios
- name: 🔨 Build
run: |
nix-build -A platform.${{ matrix.arch }} -o dist
cp -r dist/* . && mkdir -p share && chmod +w share
mkdir -p share/zsh/site-functions && ./bin/ogmios --zsh-completion-script ogmios > share/zsh/site-functions/_ogmios
mkdir -p share/bash-completion/completions && ./bin/ogmios --bash-completion-script ogmios > share/bash-completion/completions/ogmios
chmod -w share
- name: 📎 Upload Artifact
uses: actions/[email protected]
with:
name: ogmios-${{ matrix.arch }}-linux
path: |
bin
share
# █████████ █████ ███ █████
# ███░░░░░███ ░░███ ░░░ ░░███
# ░███ ░░░ ██████ ████████ █████ █████ ██████ ████████ ░███ ████ ████████ ███████
# ░░█████████ ███░░███░░███░░███░░███ ░░███ ███░░███░░███░░███ ░███ ░░███ ░░███░░███ ░░░███░
# ░░░░░░░░███░███████ ░███ ░░░ ░███ ░███ ░███████ ░███ ░░░ ░███ ░███ ░███ ░███ ░███
# ███ ░███░███░░░ ░███ ░░███ ███ ░███░░░ ░███ ░███ █ ░███ ░███ ░███ ░███ ███
# ░░█████████ ░░██████ █████ ░░█████ ░░██████ █████ ███████████ █████ ████ █████ ░░█████
# ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░ ░░░░░ ░░░░░
server_lint:
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
with:
submodules: true
- name: 🔬 hlint
working-directory: server
shell: bash
env:
PACKAGE: hlint
REPOSITORY: ndmitchell/hlint
PLATFORM: x86_64-linux
RELEASE: v3.2
VERSION: 3.2
run: |
curl -sSL https://raw.github.com/cardanosolutions/ogmios/master/scripts/exec-from-github.sh | sh -s src test app -h .hlint.yaml
- name: 🧐 stylish-haskell
working-directory: server
shell: bash
env:
PACKAGE: stylish-haskell
REPOSITORY: jaspervdj/stylish-haskell
PLATFORM: linux-x86_64
RELEASE: v0.13.0.0
VERSION: v0.13.0.0
run: |
curl -sSL https://raw.github.com/cardanosolutions/ogmios/master/scripts/exec-from-github.sh | sh -s $(find src test app -type f -name '*.hs' ! -path '*.stack-work*') -i -c .stylish-haskell.yaml
if [ -z "$(git status --porcelain)" ]; then
echo "No style errors detected."
else
echo "Style errors detected:"
git diff
exit 1
fi
#
# ███████████ █████████ ███ █████ █████████ ████ ███ █████
# ░█░░░███░░░█ ███░░░░░███ ░░░ ░░███ ███░░░░░███░░███ ░░░ ░░███
# ░ ░███ ░ █████ ████ ████████ ██████ ░███ ░░░ ██████ ████████ ████ ████████ ███████ ███ ░░░ ░███ ████ ██████ ████████ ███████
# ░███ ░░███ ░███ ░░███░░███ ███░░███░░█████████ ███░░███░░███░░███░░███ ░░███░░███░░░███░ ░███ ░███ ░░███ ███░░███░░███░░███ ░░░███░
# ░███ ░███ ░███ ░███ ░███░███████ ░░░░░░░░███░███ ░░░ ░███ ░░░ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███████ ░███ ░███ ░███
# ░███ ░███ ░███ ░███ ░███░███░░░ ███ ░███░███ ███ ░███ ░███ ░███ ░███ ░███ ███ ░░███ ███ ░███ ░███ ░███░░░ ░███ ░███ ░███ ███
# █████ ░░███████ ░███████ ░░██████ ░░█████████ ░░██████ █████ █████ ░███████ ░░█████ ░░█████████ █████ █████░░██████ ████ █████ ░░█████
# ░░░░░ ░░░░░███ ░███░░░ ░░░░░░ ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░███░░░ ░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░
# ███ ░███ ░███ ░███
# ░░██████ █████ █████
# ░░░░░░ ░░░░░ ░░░░░
clients_TypeScript:
needs: [server_build]
strategy:
matrix:
os: [ubuntu-20.04]
arch: [amd64]
network: [preview]
cardanoNodeVersion: [1.35.7]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
with:
submodules: true
- name: ⌚ Get Date/Time
id: date-time
shell: bash
run: |
echo "::set-output name=value::$(/bin/date -u "+%Y%m%d-%H%M%S")"
- name: 🧰 Setup Node.js
uses: actions/[email protected]
with:
node-version: lts/Gallium
- name: 🔨 Build
working-directory: clients/TypeScript
run: |
yarn install --frozen-lockfile --non-interactive --logevel=error
yarn build
yarn lint
- name: 📥 Download
uses: actions/[email protected]
with:
name: ogmios-${{ matrix.arch }}-linux
path: server
- name: 💾 Cache cardano-node DB
id: cache
uses: actions/[email protected]
with:
path: ${{ runner.temp }}/db-${{ matrix.network }}
key: cardano-node-ogmios-${{ matrix.network }}-${{ steps.date-time.outputs.value }}
restore-keys: |
cardano-node-ogmios-${{ matrix.network }}-
- name: 🔬 Test
if: matrix.network == 'preview'
working-directory: clients/TypeScript
shell: bash
env:
CONFDIR: /home/runner/work/ogmios/ogmios/server/config/network/${{ matrix.network }}
run: |
chmod +x ../../server/bin/ogmios
sudo ../../server/bin/ogmios --port 1338 --log-level error --node-socket ${{ runner.temp }}/ipc/node.socket --node-config $CONFDIR/cardano-node/config.json &
docker pull inputoutput/cardano-node:${{ matrix.cardanoNodeVersion }}
docker run -d --name cardano-node \
-v ${{ runner.temp }}/db-${{ matrix.network }}:/db \
-v ${{ runner.temp }}/ipc:/ipc \
-v $CONFDIR/cardano-node:/config \
-v $CONFDIR/genesis:/genesis \
inputoutput/cardano-node:${{ matrix.cardanoNodeVersion }} run --config /config/config.json --database-path /db --socket-path /ipc/node.socket --topology /config/topology.json
../../scripts/wait-for-sync.sh 1338 1
yarn test
docker stop cardano-node
docker rm cardano-node
#
# ███████████ █████████ ███ █████ ███████████ ██████████ ███████████ █████
# ░█░░░███░░░█ ███░░░░░███ ░░░ ░░███ ░░███░░░░░███ ░░███░░░░░█░░███░░░░░███░░███
# ░ ░███ ░ █████ ████ ████████ ██████ ░███ ░░░ ██████ ████████ ████ ████████ ███████ ░███ ░███ ░███ █ ░ ░███ ░███ ░███
# ░███ ░░███ ░███ ░░███░░███ ███░░███░░█████████ ███░░███░░███░░███░░███ ░░███░░███░░░███░ ░██████████ ░██████ ░██████████ ░███
# ░███ ░███ ░███ ░███ ░███░███████ ░░░░░░░░███░███ ░░░ ░███ ░░░ ░███ ░███ ░███ ░███ ░███░░░░░███ ░███░░█ ░███░░░░░░ ░███
# ░███ ░███ ░███ ░███ ░███░███░░░ ███ ░███░███ ███ ░███ ░███ ░███ ░███ ░███ ███ ░███ ░███ ░███ ░ █ ░███ ░███ █
# █████ ░░███████ ░███████ ░░██████ ░░█████████ ░░██████ █████ █████ ░███████ ░░█████ █████ █████ ██████████ █████ ███████████
# ░░░░░ ░░░░░███ ░███░░░ ░░░░░░ ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░███░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░░░░░░░
# ███ ░███ ░███ ░███
# ░░██████ █████ █████
# ░░░░░░ ░░░░░ ░░░░░
clients_TypeScript_repl:
if: ${{ github.event_name == 'push' }}
runs-on: ${{ matrix.os }}
needs: [clients_TypeScript]
strategy:
matrix:
os: [ubuntu-20.04]
target: [linux,macos,win.exe]
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
- name: 🧰 Setup Node.js
uses: actions/[email protected]
with:
node-version: lts/Gallium
- name: 📦 Package REPL
working-directory: clients/TypeScript
run: |
yarn install --frozen-lockfile --non-interactive --logevel=error
yarn repl:pkg
- name: 📎 Upload REPL exe
uses: actions/[email protected]
with:
name: cardano-ogmios-repl-${{ matrix.target }}-${{ github.sha }}
path: clients/TypeScript/packages/repl/build/cardano-ogmios-repl-${{ matrix.target }}
# ███████████ █████████ ███ █████ ██████ █████ ███████████ ██████ ██████
# ░█░░░███░░░█ ███░░░░░███ ░░░ ░░███ ░░██████ ░░███ ░░███░░░░░███░░██████ ██████
# ░ ░███ ░ █████ ████ ████████ ██████ ░███ ░░░ ██████ ████████ ████ ████████ ███████ ░███░███ ░███ ░███ ░███ ░███░█████░███
# ░███ ░░███ ░███ ░░███░░███ ███░░███░░█████████ ███░░███░░███░░███░░███ ░░███░░███░░░███░ ░███░░███░███ ░██████████ ░███░░███ ░███
# ░███ ░███ ░███ ░███ ░███░███████ ░░░░░░░░███░███ ░░░ ░███ ░░░ ░███ ░███ ░███ ░███ ░███ ░░██████ ░███░░░░░░ ░███ ░░░ ░███
# ░███ ░███ ░███ ░███ ░███░███░░░ ███ ░███░███ ███ ░███ ░███ ░███ ░███ ░███ ███ ░███ ░░█████ ░███ ░███ ░███
# █████ ░░███████ ░███████ ░░██████ ░░█████████ ░░██████ █████ █████ ░███████ ░░█████ █████ ░░█████ █████ █████ █████
# ░░░░░ ░░░░░███ ░███░░░ ░░░░░░ ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░███░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░
# ███ ░███ ░███ ░███
# ░░██████ █████ █████
# ░░░░░░ ░░░░░ ░░░░░
clients_TypeScript_npm:
if: ${{ github.event_name == 'push' }}
runs-on: ${{ matrix.os }}
needs: [clients_TypeScript]
strategy:
matrix:
os: [ubuntu-20.04]
package: [schema,client,repl]
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
- name: 🧰 Setup Node.js
uses: actions/[email protected]
with:
node-version: lts/Gallium
- name: 📦 Pack
working-directory: clients/TypeScript
run: |
yarn install --frozen-lockfile --non-interactive --logevel=error
./scripts/pack.sh
- name: 📎 Upload npm packages
uses: actions/[email protected]
with:
name: cardano-ogmios-clients-ts-packages
path: |
clients/TypeScript/cardano-ogmios-client-${{ github.sha }}.tgz
clients/TypeScript/cardano-ogmios-schema-${{ github.sha }}.tgz
clients/TypeScript/cardano-ogmios-repl-${{ github.sha }}.tgz
- name: 📤 Publish client package to npm registry
if: ${{ startsWith(github.ref, 'refs/tags') }}
uses: JS-DevTools/npm-publish@v1
with:
check-version: true
package: clients/TypeScript/packages/${{ matrix.package }}/package.json
token: ${{ secrets.NPM_TOKEN }}
# ██████████ ███████ █████████ █████ ████ ██████████ ███████████
# ░░███░░░░███ ███░░░░░███ ███░░░░░███░░███ ███░ ░░███░░░░░█░░███░░░░░███
# ░███ ░░███ ███ ░░███ ███ ░░░ ░███ ███ ░███ █ ░ ░███ ░███
# ░███ ░███░███ ░███░███ ░███████ ░██████ ░██████████
# ░███ ░███░███ ░███░███ ░███░░███ ░███░░█ ░███░░░░░███
# ░███ ███ ░░███ ███ ░░███ ███ ░███ ░░███ ░███ ░ █ ░███ ░███
# ██████████ ░░░███████░ ░░█████████ █████ ░░████ ██████████ █████ █████
# ░░░░░░░░░░ ░░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░
docker:
strategy:
matrix:
os: [ ubuntu-20.04 ]
target: [ ogmios, cardano-node-ogmios ]
network: [ "mainnet", "preprod", "preview" ]
cardano_node_version: [ "1.35.7" ]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/[email protected]
with:
submodules: true
- name: 🧰 Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 🧐 hadolint
uses: brpaz/[email protected]
with:
dockerfile: "./Dockerfile"
failure-threshold: warning
ignore: DL3029 DL3059
- name: 🐳 Login to DockerHub
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: 📝 Base Variables
id: base-variables
run: |
echo ::set-output name=image::cardanosolutions/${{ matrix.target }}
- name: 📝 Tag Variables
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
id: tag-variables
run: |
echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: 🔨 Build and push (default latest)
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:latest
target: ${{ matrix.target }}
platforms: linux/amd64
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
cache-to: type=inline
- name: 🔨 Build and push (network latest)
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:latest-${{ matrix.network }}
target: ${{ matrix.target }}
platforms: linux/amd64
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest-${{ matrix.network }}
cache-to: type=inline
- name: 🏷️ Build and push (default tag)
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' && startsWith(github.ref, 'refs/tags') && matrix.target == 'cardano-node-ogmios' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}
target: ${{ matrix.target }}
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
cache-to: type=inline
- name: 🏷️ Build and push (default tag)
if: ${{ github.event_name == 'push' && matrix.network == 'mainnet' && startsWith(github.ref, 'refs/tags') && matrix.target == 'ogmios' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
CARDANO_NODE_VERSION=${{ matrix.cardano_node_version }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}
target: ${{ matrix.target }}
platforms: linux/amd64
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest
cache-to: type=inline
- name: 🏷️ Build and push (network tags)
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.target == 'cardano-node-ogmios' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
CARDANO_NODE_VERSION=${{ matrix.cardano_node_version }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}_${{ matrix.cardano_node_version }}-${{ matrix.network }}
target: ${{ matrix.target }}
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest-${{ matrix.network }}
cache-to: type=inline
- name: 🏷️ Build and push (network tags)
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.target == 'ogmios' }}
uses: docker/build-push-action@v2
with:
build-args: |
NETWORK=${{ matrix.network }}
context: .
push: true
tags: ${{ steps.base-variables.outputs.image }}:${{ steps.tag-variables.outputs.tag }}-${{ matrix.network }}
target: ${{ matrix.target }}
platforms: linux/amd64
cache-from: type=registry,ref=${{ steps.base-variables.outputs.image }}:latest-${{ matrix.network }}
cache-to: type=inline