Skip to content

Commit

Permalink
move build to it's own workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Aug 29, 2024
1 parent 922695f commit 26b1ca8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 49 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ env:
DFX_VERSION: 0.21.0
NODE_VERSION: 20
jobs:
generate-tests:
get-all-test-dirs:
if: ${{ contains(github.head_ref, 'release--') }}
name: Get all test dirs
runs-on: ubuntu-latest
outputs:
Expand All @@ -26,15 +27,15 @@ jobs:
./tests
exclude_dirs: ''

determine-should-run-tests:
determine-is-manual-release:
if: ${{ contains(github.head_ref, 'release--') }}
name: Determine If Tests Should Run
runs-on: ubuntu-latest
outputs:
should_run_tests: ${{ steps.determine_should_run_tests.outputs.should_run_tests }}
is_manual_release: ${{ steps.determine_is_manual_release.outputs.is_manual_release }}
steps:
- uses: actions/checkout@v4
- id: determine_should_run_tests
# Determine if tests should run for this pr. If it's a manually submitted release candidate no tests will run.
- id: determine_is_manual_release
run: |
BRANCH_NAME="${{ github.head_ref }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
Expand All @@ -45,19 +46,19 @@ jobs:
IS_AUTOMATED_RELEASE="true"
fi
if [[ "${{env.IS_RELEASE_CANDIDATE}}" == "true" && "$IS_AUTOMATED_RELEASE" == "false" ]]; then
echo "should_run_tests=false" >> "$GITHUB_OUTPUT"
if [[ "$IS_AUTOMATED_RELEASE" == "false" ]]; then
echo "is_manual_release=false" >> "$GITHUB_OUTPUT"
else
echo "should_run_tests=true" >> "$GITHUB_OUTPUT"
echo "is_manual_release=true" >> "$GITHUB_OUTPUT"
fi
release-candidate-deploy:
name: Deploy Release Candidate for Release Branches
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested
if: ${{ !needs.determine-should-run-tests.outputs.should_run_tests }}
if: ${{ !needs.determine-is-manual-release.outputs.is_manual_release }}
needs:
- generate-tests
- determine-should-run-tests
- get-all-test-dirs
- determine-is-manual-release
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
Expand Down Expand Up @@ -86,4 +87,4 @@ jobs:
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
- name: Publish Release
run: ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.generate-tests.outputs.all_tests) }}
run: ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-all-test-dirs.outputs.all_tests) }}
37 changes: 0 additions & 37 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,6 @@ jobs:
echo "should_run_tests=true" >> "$GITHUB_OUTPUT"
fi
release-candidate-deploy:
name: Deploy Release Candidate for Release Branches
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested
if: ${{ !needs.determine-should-run-tests.outputs.should_run_tests }}
needs:
- generate-tests
- determine-should-run-tests
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=${{ env.DFX_VERSION }} sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
# TODO we should use some Action-specific bot account
- name: Configure git for Publishing Release
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
- name: Publish Release
run: ./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.generate-tests.outputs.all_tests) }}

run-test:
# Tests can either run against the current code of Azle found in the repository, or the code deployed by the GitHub Action to npm.
# Feature branch pull requests (pull requests without release-- in the base branch name) will run all tests against the code found in the repository.
Expand Down

0 comments on commit 26b1ca8

Please sign in to comment.