Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish staging without passing tests #7486

Merged
merged 24 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
115 changes: 31 additions & 84 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
echo "scala_version_matrix=[\"2.13\"]" >> $GITHUB_OUTPUT
fi


build:
name: Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -521,93 +522,39 @@ jobs:
script: |
core.setFailed('Snapshots updated, chceck comments!')

#TODO: extract to different workflow?
publish:
runs-on: ubuntu-latest
needs: [build, build-fe, setup, tests, integrationTests, slowTests, frontendTests, cypressTests]
#TODO: should we publish everything on all those branches?
if: ${{ github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/demo' || startsWith(github.ref, 'refs/heads/preview') || startsWith(github.ref, 'refs/heads/release') }}
env:
#TODO: shouldn't be needed...
nexusUrl: https://oss.sonatype.org/content/repositories/snapshots
# We add dev model to staging because it is used in dev used on this environment, but we also add it for other branches for purpose of cypress tests
addDevArtifacts: true
NUSSKNACKER_VERSION: ${{ needs.setup.outputs.nk_snapshot_version }}
GIT_SOURCE_BRANCH: ${{ needs.setup.outputs.git_source_branch }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
steps:
- name: Cancel previous runs
if: github.event_name != 'push'
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: coursier/setup-action@v1
with:
jvm: temurin:1.11.0.17
- name: Cache ivy packages
uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: sbt-cache-${{ hashFiles('**/*.sbt') }}
restore-keys: sbt
- uses: actions/download-artifact@v4
with:
name: build-target
- name: Untar artifacts
shell: bash
run: tar xfz target.tgz
- uses: actions/download-artifact@v4
with:
name: build-fe-dist
- name: Untar fe artifacts
shell: bash
run: tar xfz fe-dist.tgz
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup buildx builder
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Try to free space
run: |
# Workaround to prevent "no space left on device" during buildx build - https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: sbt/setup-sbt@v1
- name: Publish with scaladocs
if: ${{ github.ref == 'refs/heads/staging' }}
env:
# Workaround to preveent "no space left on device" during publishDocker failed to create temp dir: mkdir /tmp/containerd-mountXYZ
TMPDIR: ${{ github.workspace }}
shell: bash
#TODO: handle version better, do we want to publish docker image for older scala versions? If so, how should it be tagged?
run: sbt "set ThisBuild / version := \"$NUSSKNACKER_VERSION\"" +publish +dist/Docker/publish +liteEngineRuntimeApp/Docker/publish
- name: Publish without scaladocs
if: ${{ github.ref != 'refs/heads/staging' }}
env:
# Workaround to preveent "no space left on device" during publishDocker failed to create temp dir: mkdir /tmp/containerd-mountXYZ
TMPDIR: ${{ github.workspace }}
shell: bash
#TODO: handle version better, do we want to publish docker image for older scala versions? If so, how should it be tagged?
run: sbt "set ThisBuild / version := \"$NUSSKNACKER_VERSION\"; set ThisBuild / packageDoc / publishArtifact := false; set Compile / doc / sources := Seq.empty" +publish +dist/Docker/publish +liteEngineRuntimeApp/Docker/publish
publish-after-tests:
name: Publish With Tests
needs: ['build', 'build-fe', 'setup', 'tests', 'integrationTests', 'slowTests', 'frontendTests', 'cypressTests']
uses: ./.github/workflows/publish.yml
with:
should_run: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/demo' || startsWith(github.ref, 'refs/heads/preview') || startsWith(github.ref, 'refs/heads/release') }}
secrets:
nussknacker_version: ${{ needs.setup.outputs.nk_snapshot_version }}
git_source_branch: ${{ needs.setup.outputs.git_source_branch }}
sonatype_user: ${{ secrets.SONATYPE_USER }}
sonatype_password: ${{ secrets.SONATYPE_PASSWORD }}
github__token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

publish-before-tests:
name: Publish Without Tests
needs: ['build', 'build-fe', 'setup']
uses: ./.github/workflows/publish.yml
with:
should_run: ${{ github.ref == 'refs/heads/staging' }}
secrets:
nussknacker_version: ${{ needs.setup.outputs.nk_snapshot_version }}
git_source_branch: ${{ needs.setup.outputs.git_source_branch }}
sonatype_user: ${{ secrets.SONATYPE_USER }}
sonatype_password: ${{ secrets.SONATYPE_PASSWORD }}
github__token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_user: ${{ secrets.DOCKERHUB_USER }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

trigger-external-build:
runs-on: ubuntu-latest
needs: [ setup, publish ]
needs: [ setup, publish-before-tests ]
if: ${{ github.ref == 'refs/heads/staging' }}
strategy:
matrix:
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Publish
on:
workflow_call:
inputs:
should_run:
description: "Indicates if the job should be run"
required: true
type: boolean
secrets:
nussknacker_version:
required: true
git_source_branch:
required: true
sonatype_user:
required: true
sonatype_password:
required: true
github__token:
required: true
dockerhub_user:
required: true
dockerhub_token:
required: true

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ inputs.should_run }}
env:
nexusUrl: https://oss.sonatype.org/content/repositories/snapshots
addDevArtifacts: true
NUSSKNACKER_VERSION: ${{ secrets.nussknacker_version }}
GIT_SOURCE_BRANCH: ${{ secrets.git_source_branch }}
SONATYPE_USERNAME: ${{ secrets.sonatype_user }}
SONATYPE_PASSWORD: ${{ secrets.sonatype_password }}
steps:
- name: Cancel previous runs
if: github.event_name != 'push'
uses: styfle/[email protected]
with:
access_token: ${{ secrets.github__token }}
- uses: actions/checkout@v3
- uses: coursier/setup-action@v1
with:
jvm: temurin:1.11.0.17
- name: Cache ivy packages
uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: sbt-cache-${{ hashFiles('**/*.sbt') }}
restore-keys: sbt
- uses: actions/download-artifact@v4
with:
name: build-target
- name: Untar artifacts
shell: bash
run: tar xfz target.tgz
- uses: actions/download-artifact@v4
with:
name: build-fe-dist
- name: Untar fe artifacts
shell: bash
run: tar xfz fe-dist.tgz
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.dockerhub_user }}
password: ${{ secrets.dockerhub_token }}
- name: Setup buildx builder
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Try to free space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
- uses: sbt/setup-sbt@v1
- name: Publish with scaladocs
if: ${{ inputs.ref == 'refs/heads/staging' }}
env:
# Workaround to preveent "no space left on device" during publishDocker failed to create temp dir: mkdir /tmp/containerd-mountXYZ
TMPDIR: ${{ github.workspace }}
shell: bash
#TODO: handle version better, do we want to publish docker image for older scala versions? If so, how should it be tagged?
run: sbt "set ThisBuild / version := \"$NUSSKNACKER_VERSION\"" +publish +dist/Docker/publish +liteEngineRuntimeApp/Docker/publish
- name: Publish without scaladocs
if: ${{ inputs.ref != 'refs/heads/staging' }}
env:
# Workaround to preveent "no space left on device" during publishDocker failed to create temp dir: mkdir /tmp/containerd-mountXYZ
TMPDIR: ${{ github.workspace }}
shell: bash
#TODO: handle version better, do we want to publish docker image for older scala versions? If so, how should it be tagged?
run: sbt "set ThisBuild / version := \"$NUSSKNACKER_VERSION\"; set ThisBuild / packageDoc / publishArtifact := false; set Compile / doc / sources := Seq.empty" +publish +dist/Docker/publish +liteEngineRuntimeApp/Docker/publish
Loading