123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- name: self-hosted
- on:
- push:
- branches:
- - master
- - releases/**
- pull_request:
- # Cancel in progress workflows on pull_requests.
- # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
- concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
- # hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
- env:
- SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
- NODE_OPTIONS: '--max-old-space-size=4096'
- jobs:
- self-hosted:
- runs-on: ubuntu-latest
- timeout-minutes: 30
- steps:
- - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
- id: setup-node
- with:
- node-version-file: '.volta.json'
- - uses: getsentry/action-setup-venv@a133e6fd5fa6abd3f590a1c106abda344f5df69f # v2.1.0
- with:
- python-version: 3.12.6
- cache-dependency-path: requirements-dev-frozen.txt
- install-cmd: python3 -m tools.hack_pip
- - name: Step configurations
- id: config
- run: |
- echo "webpack-path=.webpack_cache" >> "$GITHUB_OUTPUT"
- echo "WEBPACK_CACHE_PATH=.webpack_cache" >> "$GITHUB_ENV"
- - name: webpack cache
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
- with:
- path: ${{ steps.config.outputs.webpack-path }}
- key: ${{ runner.os }}-self-hosted-webpack-cache-${{ hashFiles('webpack.config.ts') }}
- - name: node_modules cache
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
- id: nodemodulescache
- with:
- path: node_modules
- key: ${{ runner.os }}-self-hosted-node-modules-${{ hashFiles('yarn.lock', '.volta.json') }}
- - name: Install Javascript Dependencies
- if: steps.nodemodulescache.outputs.cache-hit != 'true'
- run: yarn install --frozen-lockfile --production
- - run: |
- python3 -m tools.fast_editable --path .
- python3 -m sentry.build.main
- - run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
- env:
- GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: github.event_name != 'pull_request'
- - run: docker buildx create --driver docker-container --use
- - run: |
- if [ ${{ github.event_name }} = 'push' ]; then
- args=(
- --tag ghcr.io/getsentry/sentry-self-hosted:latest
- --push
- )
- else
- args=()
- fi
- docker buildx build \
- --pull \
- --cache-from ghcr.io/getsentry/sentry-self-hosted:latest \
- --cache-to type=inline \
- --tag ghcr.io/getsentry/sentry-self-hosted:${{ github.sha }} \
- --file self-hosted/Dockerfile \
- --build-arg SOURCE_COMMIT=${{ github.sha }} \
- "${args[@]}" \
- .
|