Skip to content

DEV: remove create_db after running #2156

DEV: remove create_db after running

DEV: remove create_db after running #2156

Workflow file for this run

on:
push:
branches:
- main
paths-ignore:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
pull_request:
paths-ignore:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
schedule:
- cron: "0 0 * * *"
concurrency:
group: build-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
env:
BUILDKIT_PROGRESS: plain
DISCOURSE_TURBO_RSPEC_RETRY_AND_LOG_FLAKY_TESTS: true
jobs:
timestamp:
runs-on: ubuntu-latest
outputs:
timestamp: ${{ steps.timestamp.outputs.timestamp }}
steps:
- id: timestamp
run: |
timestamp=`date +%Y%m%d-%H%M`
echo "timestamp=$timestamp"
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT
base:
# `unbuntu-22.04-8core` for arch amd64 non-scheduled builds
# `unbuntu-22.04` for arch amd64 scheduled builds
# `unbuntu-22.04-8core-arm` for arch arm64 non-scheduled builds
# `unbuntu-22.04-2core-arm` for arch arm64 scheduled builds
runs-on: ubuntu-22.04${{ ((github.event_name != 'schedule') && '-8core') || (( matrix.arch == 'arm64' && '-2core' ) || '') }}${{ (matrix.arch == 'arm64') && '-arm' || '' }}
strategy:
matrix:
arch: [amd64, arm64]
timeout-minutes: ${{ (github.event_name == 'schedule' && 90) || ((matrix.arch == 'arm64' && 45) || 30) }}
needs: timestamp
env:
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build deps image
working-directory: image
run: |
ruby auto_build.rb base_deps_${{ matrix.arch }}
- name: build slim image for `main` branch
working-directory: image
run: |
ruby auto_build.rb base_slim_main_${{ matrix.arch }}
- name: tag slim image for `main` branch
run: |
docker tag discourse/base:build_slim_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-slim-${{ matrix.arch }}
- name: build slim image for `stable` branch
working-directory: image
run: |
ruby auto_build.rb base_slim_stable_${{ matrix.arch }}
- name: build release images for `main` branch
working-directory: image
run: |
ruby auto_build.rb base_release_main_${{ matrix.arch }}
- name: build release images for `stable` branch
working-directory: image
run: |
ruby auto_build.rb base_release_stable_${{ matrix.arch }}
- name: tag release images
run: |
docker tag discourse/base:build_release_main_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
docker tag discourse/base:build_release_stable_${{ matrix.arch }} discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
- name: build test_build image for `main` branch
working-directory: image
run: |
ruby auto_build.rb discourse_test_build_${{ matrix.arch }}
- name: run specs for `main` branch
run: |
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build_${{ matrix.arch }}
- name: build & tag dev image for `main` branch
working-directory: image
run: |
ruby auto_build.rb discourse_dev_${{ matrix.arch }}
docker tag discourse/discourse_dev:build_${{ matrix.arch }} discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
- name: Print summary
run: |
docker images discourse/base
- name: push to dockerhub
if: github.ref == 'refs/heads/main'
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-slim-${{ matrix.arch }}
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }}
docker push discourse/base:2.0.${{ env.TIMESTAMP }}-stable-${{ matrix.arch }}
docker push discourse/discourse_dev:${{ env.TIMESTAMP }}-${{ matrix.arch }}
- name: Push discourse/base:aarch64 image for backwards compatibility
if: (github.ref == 'refs/heads/main') && (matrix.arch == 'arm64')
run: |
docker tag discourse/base:2.0.${{ env.TIMESTAMP }}-main-${{ matrix.arch }} discourse/base:aarch64
docker push discourse/base:aarch64
push_multiarch_manifests:
runs-on: ubuntu-latest
needs: [base, timestamp]
env:
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
if: github.ref == 'refs/heads/main'
steps:
- name: create and push multiarch manifests
run: |
docker login --username discoursebuild --password ${{ secrets.DOCKERHUB_PASSWORD }}
# Slim timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-slim \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-arm64
# Slim release
docker manifest create discourse/base:slim \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-slim-arm64
# Full Discourse `main` branch timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }} \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
# Full Discourse `stable` branch timestamped
docker manifest create discourse/base:2.0.${{ env.TIMESTAMP }}-stable \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-arm64
# Full Discourse `main` branch release
docker manifest create discourse/base:release \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-main-arm64
# Full Discourse `stable` branch release
docker manifest create discourse/base:release-stable \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-amd64 \
-a discourse/base:2.0.${{ env.TIMESTAMP }}-stable-arm64
# Dev timestamped
docker manifest create discourse/discourse_dev:${{ env.TIMESTAMP }} \
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-amd64 \
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-arm64
# Dev release
docker manifest create discourse/discourse_dev:release \
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-amd64 \
-a discourse/discourse_dev:${{ env.TIMESTAMP }}-arm64
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-slim
docker manifest push discourse/base:slim
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}
docker manifest push discourse/base:2.0.${{ env.TIMESTAMP }}-stable
docker manifest push discourse/base:release
docker manifest push discourse/base:release-stable
docker manifest push discourse/discourse_dev:${{ env.TIMESTAMP }}
docker manifest push discourse/discourse_dev:release
test:
runs-on: ubuntu-22.04${{ ((github.event_name != 'schedule') && '-8core') || '' }}
timeout-minutes: 30
needs: base
defaults:
run:
working-directory: image/discourse_test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build discourse_test:slim
run: |
docker buildx build . --load \
--build-arg from_tag=slim \
--target base \
--tag discourse/discourse_test:slim
- name: build discourse_test:slim-browsers
run: |
docker buildx build . --load \
--build-arg from_tag=slim \
--target with_browsers \
--tag discourse/discourse_test:slim-browsers
- name: build discourse_test:release
run: |
docker buildx build . --load \
--build-arg from_tag=release \
--target release \
--tag discourse/discourse_test:release
- name: Print summary
run: |
docker images discourse/discourse_test
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/discourse_test:slim
docker push discourse/discourse_test:slim-browsers
docker push discourse/discourse_test:release