Merge pull request #24 from seqeralabs/workdir-is-optional #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Action | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
pull_request: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
run-tower: | |
name: Launch on Nextflow Tower | |
# Don't try to run on forked repos | |
if: github.repository == 'seqeralabs/action-tower-launch' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
id: aws_run | |
# Use repository secrets for sensitive fields | |
with: | |
access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} | |
pipeline: hello-aws | |
workspace_id: ${{ secrets.AWS_TOWER_WORKSPACE_ID }} | |
compute_env: ${{ secrets.AWS_TOWER_COMPUTE_ENV }} | |
run_name: ${{ github.job }}_${{ github.sha }} | |
workdir: ${{ secrets.AWS_S3_BUCKET }}/work/${{ github.sha }} | |
api_endpoint: ${{ secrets.PLATFORM_ENDPOINT }} | |
- uses: ./ | |
id: azure_run | |
# Use repository secrets for sensitive fields | |
with: | |
access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} | |
pipeline: hello-azure | |
workspace_id: ${{ secrets.AZURE_TOWER_WORKSPACE_ID }} | |
compute_env: ${{ secrets.AZURE_TOWER_COMPUTE_ENV }} | |
run_name: ${{ github.job }}_${{ github.sha }} | |
workdir: ${{ secrets.AZURE_WORK_CONTAINER }}/work/${{ github.sha }} | |
api_endpoint: ${{ secrets.PLATFORM_ENDPOINT }} | |
- uses: ./ | |
id: gcp_run | |
# Use repository secrets for sensitive fields | |
with: | |
access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} | |
pipeline: hello-gcp | |
workspace_id: ${{ secrets.GCP_TOWER_WORKSPACE_ID }} | |
compute_env: ${{ secrets.GCP_TOWER_COMPUTE_ENV }} | |
run_name: ${{ github.job }}_${{ github.sha }} | |
workdir: ${{ secrets.GCP_BUCKET }}/work/${{ github.sha }} | |
api_endpoint: ${{ secrets.PLATFORM_ENDPOINT }} | |
- name: Comment PR | |
if: github.event_name == 'pull_request' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
### 🚀 Pipelines launched | |
| Name | Info | | |
|------|------| | |
| 🔨 AWS Workflow ID | `${{ steps.aws_run.outputs.workflowId }}` | | |
| 🏠 AWS Workspace | `${{ steps.aws_run.outputs.workspaceRef }}` | | |
| 🗂️ AWS Workspace ID | `${{ steps.aws_run.outputs.workspaceId }}` | | |
| 😎 AWS Workflow URL | ${{ steps.aws_run.outputs.workflowUrl }} | | |
| 🔨 Azure Workflow ID | `${{ steps.azure_run.outputs.workflowId }}` | | |
| 🏠 Azure Workspace | `${{ steps.azure_run.outputs.workspaceRef }}` | | |
| 🗂️ Azure Workspace ID | `${{ steps.azure_run.outputs.workspaceId }}` | | |
| 😎 Azure Workflow URL | ${{ steps.gcp_run.outputs.workflowUrl }} | | |
| 🔨 GCP Workflow ID | `${{ steps.gcp_run.outputs.workflowId }}` | | |
| 🏠 GCP Workspace | `${{ steps.gcp_run.outputs.workspaceRef }}` | | |
| 🗂️ GCP Workspace ID | `${{ steps.gcp_run.outputs.workspaceId }}` | | |
| 😎 GCP Workflow URL | ${{ steps.gcp_run.outputs.workflowUrl }} | | |
comment_tag: towerrun | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@v2 | |
if: failure() && github.event_name == 'pull_request' | |
with: | |
message: | | |
### :x: Pipeline launch failed | |
The pipeline launch failed. Check the logs uploaded as an artifact for more information. | |
comment_tag: towerrun | |
- uses: ./ | |
id: runfails | |
continue-on-error: true | |
with: | |
pipeline: no_pipeline_exists | |
workspace_id: ${{ secrets.TOWER_WORKSPACE_ID }} | |
access_token: ${{ secrets.TOWER_ACCESS_TOKEN }} | |
compute_env: ${{ secrets.TOWER_COMPUTE_ENV }} | |
run_name: ${{ github.job }}_${{ github.sha }} | |
workdir: ${{ secrets.AWS_S3_BUCKET }}/work/${{ github.sha }} | |
- name: Check Failure | |
if: steps.runfails.outcome == 'success' | |
run: | | |
echo "Failed to catch invalid pipeline submission: ${{ steps.runfails.outcome }}" | |
exit 1 | |
- uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: ${{ github.job }}_run_json | |
path: tower_action_*.json | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: Tower debug log file | |
path: tower_action_*.log |