Skip to content

Commit

Permalink
trigger unit and integration tests before building the packages to be…
Browse files Browse the repository at this point in the history
… released
  • Loading branch information
siosonel committed Oct 22, 2023
1 parent 907c60d commit 731d2bb
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/CD-publish-deps-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ jobs:
docker push ghcr.io/stjude/ppserver:latest
docker push ghcr.io/stjude/ppfull:latest
# TODO: !!! fix merging back to master !!!
echo "merging to master"
git fetch --depth=10 origin master:master
git switch master
git merge deps-image
git merge $BRANCH
git push
fi
29 changes: 24 additions & 5 deletions .github/workflows/CD-release-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Release Packages"
on:
push:
branches:
- release
- pkg-release
- fake-release
paths-ignore:
- '**.md'
Expand All @@ -21,7 +21,16 @@ on:
description: Build secret

jobs:
unit_test:
uses: ./.github/workflows/CI-unit.yml
secrets: inherit # pragma: allowlist secret

integration_test:
uses: ./.github/workflows/CI-integration.yml
secrets: inherit # pragma: allowlist secret

build:
needs: [unit_test, integration_test]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -67,7 +76,7 @@ jobs:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
scope: '@sjcrh'

- name: ⚡ Cache
uses: actions/cache@v2
with:
Expand All @@ -92,11 +101,21 @@ jobs:
- name: Publish packages
run: |
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" != "release" && "$BRANCH" != "master" ]]; then
if [[ "$BRANCH" != "pkg-release" && "$BRANCH" != "master" ]]; then
echo "skipping publishing"
else
else
# ./build/bump.js is called from within `ci-version-update.sh`,
# get the same updated workspaces but don't edit the package.json's (no -w option)
UPDATED=$(./build/bump.js prerelease)
./build/ci-npm-publish.sh "$UPDATED"
# !!! ---- merge back to master --- !!!
if [[ "$BRANCH" != "master" ]]; then
echo "merging to master"
git fetch --depth=10 origin master:master
git switch master
git merge $BRANCH
git push
fi
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/CI-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
build_secret:
type: string
description: Build secret
workflow_call: {}

jobs:
build:
Expand All @@ -16,13 +17,15 @@ jobs:
timeout-minutes: 20
steps:
- name: Check secret
if: github.event_name == 'workflow_dispatch'
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.build_secret }}" != "${{ secrets.BUILD_SECRET }}" ]; then
if [ "${{ github.event.inputs.build_secret }}" != "${{ secrets.BUILD_SECRET }}" ]; then
echo "Wrong build secret."
exit 1
fi
- name: Check user permission
if: github.event_name == 'workflow_dispatch'
id: check
uses: scherermichael-oss/action-has-permission@master
with:
Expand All @@ -31,9 +34,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Exit if user doesn't have write permission
if: github.event_name == 'workflow_dispatch'
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ steps.check.outputs.has-permission }}" = "false" ]
then
if [ "${{ steps.check.outputs.has-permission }}" = "false" ]; then
echo "Only users with write permission are allowed to execute this workflow."
exit 1
fi
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/CI-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ on:
- '.**ignore'
- 'docs/**'

workflow_call: {}

jobs:
build:
if: (github.event_name == 'push' && github.event.head_commit.author.email != '[email protected]') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
if: (github.event_name == 'workflow_call') || (github.event_name == 'push' && github.event.head_commit.author.email != '[email protected]') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
runs-on: ubuntu-latest
timeout-minutes: 20

Expand Down
20 changes: 9 additions & 11 deletions container/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ set -euxo pipefail
# - will pack workspaces
# - replace each workspace package.json's dependency versions
# with the tarball location as copied into the Docker build
#
# call from the proteinpaint/container dir

# from the proteinpaint/container dir
# defaults
PKGPATH=/home/root/pp/tmppack
TMPDIR=/home/root/pp/tmppack/

WORKSPACES="rust server client front"
if [[ "$1" != "" ]]; then
WORKSPACES="$1"
if (( $# == 1 )); then
PKGPATH="$1"
fi

TMPDIR=/home/root/pp/tmppack/
if [[ "$2" != "" ]]; then
if (( $# == 2 )); then
PKGPATH="$1"
TMPDIR="$2"
fi

rm -rf tmppack
mkdir tmppack

PKGPATH=/home/root/pp/tmppack
if (( $# == 1 )); then
PKGPATH="$1"
fi

FRONTTDEPNAME="@sjcrh/proteinpaint-front"
SERVERTDEPNAME="@sjcrh/proteinpaint-server"

Expand Down

0 comments on commit 731d2bb

Please sign in to comment.