Ci/nx cloud test #193
Workflow file for this run
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: Monorepo pipeline - pull request | |
on: | |
pull_request: {} | |
workflow_dispatch: {} | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value | |
group: pullrequest-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
COMPOSE_HTTP_TIMEOUT: 180 | |
GITHUB_ACTIONS_CACHE_URL: https://cache.dev01.devland.is/ | |
SKIP_GENERATED_CACHE: ${{ contains(github.event.pull_request.labels.*.name, 'skip-generated-cache') }} | |
NX_AFFECTED_ALL: ${{ contains(github.event.pull_request.labels.*.name, 'nx-affected-all') }} | |
jobs: | |
prepare: | |
runs-on: ec2-runners | |
container: | |
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest | |
timeout-minutes: 35 | |
env: | |
AFFECTED_ALL: ${{ secrets.AFFECTED_ALL }} | |
CHUNK_SIZE: 7 | |
SERVERSIDE_FEATURES_ON: '' | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
outputs: | |
TEST_CHUNKS: ${{ steps.test_projects.outputs.CHUNKS }} | |
E2E_CHUNKS: ${{ steps.e2e_projects.outputs.CHUNKS }} | |
E2E_BUILD_ID: ${{ steps.e2e_projects.outputs.BUILD_ID }} | |
LINT_CHUNKS: ${{ steps.lint_projects.outputs.CHUNKS }} | |
UNAFFECTED: ${{ steps.unaffected.outputs.UNAFFECTED }} | |
BUILD_CHUNKS: ${{ steps.build_projects.outputs.CHUNKS }} | |
BUILD_MAP: ${{ steps.build_map.outputs.BUILD_MAP }} | |
node-modules-hash: ${{ steps.calculate_node_modules_hash.outputs.node-modules-hash }} | |
generated-files-cache-key: ${{ steps.calculate_generated_files_cache_key.outputs.generated-files-cache-key }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- name: Calculate cache key for node modules | |
id: calculate_node_modules_hash | |
run: | | |
HASH="$(./scripts/ci/get-node-modules-hash.mjs)" | |
echo "node-modules-hash: ${HASH}" | |
echo "node-modules-hash=${HASH}" >> $GITHUB_OUTPUT | |
- name: Cache for NodeJS dependencies - host OS | |
id: node-modules | |
continue-on-error: true | |
uses: ./.github/actions/cache | |
with: | |
path: node_modules | |
key: ${{ steps.calculate_node_modules_hash.outputs.node-modules-hash }}-yarn | |
- name: Check node-modules cache success | |
run: '[[ "${{ steps.node-modules.outputs.success }}" != "false" ]] || exit 1' | |
- name: Building NodeJS dependencies | |
if: steps.node-modules.outputs.cache-hit != 'true' | |
run: ./scripts/ci/10_prepare-host-deps.sh | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
- name: NX format:write | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
npx nx-cloud start-ci-run --distribute-on="8 linux-medium-js" --stop-agents-after=format --with-env-vars="auto" | |
npx nx affected -t format:write | |
./infra/scripts/ci/git-check-dirty.sh "/" "nx format:write" "dirtybot" | |
run-shellcheck: | |
needs: | |
- prepare | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run ShellCheck | |
uses: ludeeus/[email protected] | |
with: | |
ignore_paths: >- | |
node_modules | |
apps/native/app/android | |
severity: warning | |
success: | |
runs-on: ec2-runners | |
container: | |
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest | |
if: always() | |
needs: | |
- prepare | |
- run-shellcheck | |
steps: | |
- name: Check prepare success | |
run: '[[ ${{ needs.prepare.result }} == "success" ]] || exit 1' | |
- name: Check run-shellcheck success | |
run: '[[ ${{ needs.run-shellcheck.result }} != "failure" ]] || exit 1' | |
- name: Announce success | |
run: echo "Build is successful" |