Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

chore: Add distro to e2e #147

Merged
merged 12 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ on:
version:
description: "version set as part of container tag"
type: string
flavour:
description: "rust-peer flavour"
type: string
default: "minimal"
release:
description: "if triggered by release workflow"
type: boolean
default: false
outputs:
rust-peer-image:
description: "rust-peer snapshot image"
value: ${{ jobs.build.outputs.image }}

jobs:
build:
name: "Build and push ${{ matrix.package }}"
name: "Build and push ${{ inputs.flavour }}"
runs-on: ubuntu-latest

strategy:
matrix:
package:
- minimal
- ipfs
- rich

# for authentication to Vault with vault-action
# https://github.com/hashicorp/vault-action#jwt-with-github-oidc-tokens
permissions:
Expand All @@ -36,6 +37,9 @@ jobs:
env:
RELEASE_VERSION: ${{ inputs.version }}

outputs:
image: "${{ inputs.image }}@${{ steps.docker.outputs.digest }}"

steps:
- name: Set build date
run: echo "BUILD_DATE=$(date '+%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_ENV
Expand Down Expand Up @@ -89,30 +93,30 @@ jobs:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Build and push ${{ matrix.package }}
- name: Build and push ${{ inputs.flavour }}
id: docker
uses: docker/build-push-action@v3
with:
context: .
push: true
target: ${{ matrix.package }}
target: ${{ inputs.flavour }}
tags: |
${{ inputs.image }}:${{ matrix.package }}
${{ inputs.image }}:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
${{ inputs.image }}:${{ inputs.flavour }}
${{ inputs.image }}:${{ inputs.flavour }}_${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push ${{ matrix.package }}
if: ${{ matrix.package == 'ipfs' && inputs.release }}
- name: Build and push ${{ inputs.flavour }}
if: ${{ inputs.flavour == 'ipfs' && inputs.release }}
uses: docker/build-push-action@v3
with:
context: .
push: true
target: ${{ matrix.package }}
target: ${{ inputs.flavour }}
tags: |
${{ inputs.image }}:latest
${{ inputs.image }}:${{ env.RELEASE_VERSION }}
Expand All @@ -124,7 +128,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Docker Hub Description
if: ${{ matrix.package == 'ipfs' && inputs.release }}
if: ${{ inputs.flavour == 'ipfs' && inputs.release }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ env.DOCKER_USERNAME }}
Expand All @@ -135,10 +139,10 @@ jobs:
if: always()
run: |
cat <<'SNAPSHOT' >> $GITHUB_STEP_SUMMARY
## rust-peer ${{ matrix.package }}
## rust-peer ${{ inputs.flavour }}
digest: `${{ steps.docker.outputs.digest }}`
```
${{ inputs.image }}:${{ matrix.package }}
${{ inputs.image }}:${{ matrix.package }}_${{ env.RELEASE_VERSION }}
${{ inputs.image }}:${{ inputs.flavour }}
${{ inputs.image }}:${{ inputs.flavour }}_${{ env.RELEASE_VERSION }}
```
SNAPSHOT
82 changes: 82 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "e2e"

on:
pull_request:
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/container.yml"
types:
- "labeled"
- "synchronize"
- "opened"
- "reopened"
push:
branches:
- "master"
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/container.yml"

env:
DOCKER_BUILDKIT: 1
FORCE_COLOR: 1

jobs:
version:
name: "Generate snapshot id"
runs-on: ubuntu-latest
if: >
github.event_name == 'push' ||
(
contains(github.event.pull_request.labels.*.name, 'e2e') &&
!github.event.pull_request.head.repo.fork
)
outputs:
id: ${{ steps.version.outputs.id }}
steps:
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main

flavours:
name: "snapshot"
needs: version
strategy:
matrix:
flavour:
- ipfs
- rich

permissions:
contents: read
id-token: write

uses: ./.github/workflows/container.yml
with:
image: "docker.fluence.dev/rust-peer-distro"
flavour: ${{ matrix.flavour }}
version: ${{ needs.version.outputs.id }}

snapshot:
needs: version

permissions:
contents: read
id-token: write

uses: ./.github/workflows/container.yml
with:
image: "docker.fluence.dev/rust-peer-distro"
flavour: minimal
version: ${{ needs.version.outputs.id }}

fluence-cli:
needs:
- snapshot
uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@debug-missing-tests
with:
rust-peer-image: "${{ needs.snapshot.outputs.rust-peer-image }}"
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ jobs:
publish:
if: needs.release-please.outputs.release-created
needs: release-please
strategy:
matrix:
flavour:
- minimal
- ipfs
- rich

permissions:
contents: read
id-token: write

uses: ./.github/workflows/container.yml
with:
version: ${{ needs.release-please.outputs.version }}
flavour: ${{ matrix.flavour }}
release: true

update-release:
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/snapshot.yml

This file was deleted.

Loading