mirror of
https://github.com/Sunscreen-tech/Sunscreen.git
synced 2026-01-14 08:07:56 -05:00
151 lines
5.0 KiB
YAML
151 lines
5.0 KiB
YAML
name: "Playground preproduction build and deploy"
|
|
|
|
on:
|
|
push:
|
|
branches: [ playground ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
DEPLOYMENT_ID: ${{ github.run_id }}.${{ github.run_attempt }}
|
|
DOCKER_REGISTRY: sunscreendeployment
|
|
DOCKER_USER: sunscreendeployment
|
|
|
|
concurrency: playground-preproduction
|
|
|
|
jobs:
|
|
build-and-prime-cache:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'recursive'
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
rust-playground/target
|
|
rust-playground/ui/frontend/node_modules
|
|
key: ${{ runner.os }}-playground-${{ hashFiles('rust-playground/Cargo.lock') }}-${{ hashFiles('rust-playground/ui/frontend/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-playground-${{ hashFiles('rust-playground/Cargo.lock') }}-${{ hashFiles('rust-playground/ui/frontend/yarn.lock') }}
|
|
${{ runner.os }}-playground-${{ hashFiles('rust-playground/Cargo.lock') }}-
|
|
${{ runner.os }}-playground-
|
|
- name: Install frontend UI dependencies
|
|
run: yarn install
|
|
working-directory: ./rust-playground/ui/frontend
|
|
- name: Compile frontend UI code
|
|
run: yarn build
|
|
working-directory: ./rust-playground/ui/frontend
|
|
- name: Build Rust binaries
|
|
run: cargo build --release --verbose --bins
|
|
working-directory: ./rust-playground
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-output
|
|
path: |
|
|
rust-playground/target/release/ui
|
|
rust-playground/target/release/rust-playground-top-crates
|
|
rust-playground/target/release/deployment
|
|
|
|
build-docker-rust:
|
|
runs-on: ubuntu-latest
|
|
needs: ['build-and-prime-cache']
|
|
|
|
strategy:
|
|
matrix:
|
|
channel: ["stable", "beta", "nightly"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'recursive'
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-output
|
|
path: rust-playground/target/release
|
|
- name: chmod 755
|
|
run: chmod 755 ./target/release/rust-playground-top-crates
|
|
working-directory: ./rust-playground
|
|
- name: Run top crates
|
|
run: ./target/release/rust-playground-top-crates --top-n 0 --omit-cookbook
|
|
working-directory: ./rust-playground
|
|
- name: Build docker images
|
|
run: ./build.sh
|
|
working-directory: ./rust-playground/compiler
|
|
env:
|
|
CHANNELS_TO_BUILD: ${{ matrix.channel }}
|
|
TOOLS_TO_BUILD: ""
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
build-playground-image:
|
|
runs-on: ubuntu-latest
|
|
needs: ['build-and-prime-cache']
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'recursive'
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-output
|
|
path:
|
|
rust-playground/target/release
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
rust-playground/target
|
|
rust-playground/ui/frontend/node_modules
|
|
key: ${{ runner.os }}-playground-${{ hashFiles('rust-playground/Cargo.lock') }}-${{ hashFiles('rust-playground/ui/frontend/yarn.lock') }}
|
|
- name: Install frontend UI dependencies
|
|
run: yarn install
|
|
working-directory: ./rust-playground/ui/frontend
|
|
- name: Compile frontend UI code
|
|
run: yarn build
|
|
working-directory: ./rust-playground/ui/frontend
|
|
- name: docker build
|
|
run: docker build -t $DOCKER_REGISTRY/playground:$DEPLOYMENT_ID --build-arg docker_repo=sunscreendeployment --build-arg deployment_id=$DEPLOYMENT_ID --build-arg tools="rust-stable rust-beta rust-nightly" -f deployment/Dockerfile .
|
|
working-directory: ./rust-playground
|
|
- name: docker login
|
|
run: docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
|
|
env:
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: docker push
|
|
run: docker push $DOCKER_REGISTRY/playground:$DEPLOYMENT_ID
|
|
|
|
deploy-preproduction:
|
|
runs-on: ubuntu-latest
|
|
needs: ['build-and-prime-cache', 'build-playground-image', 'build-docker-rust']
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'recursive'
|
|
- name: Deploy to preproduction
|
|
run: ./deploy.sh
|
|
working-directory: ./rust-playground/deployment
|
|
env:
|
|
DOCKER_USER: sunscreendeployment
|
|
ENVIRONMENT_ID: e-svmuitwvz8
|
|
S3_BUCKET: elasticbeanstalk-us-west-2-436473215996
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYMENT_AWS_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: us-west-2
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYMENT_AWS_ACCESS_KEY_SECRET }}
|
|
|
|
delete-artifacts:
|
|
runs-on: ubuntu-latest
|
|
needs: ['deploy-preproduction']
|
|
if: always()
|
|
|
|
steps:
|
|
- uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-output
|