Skip to content

Commit

Permalink
Github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Apr 26, 2024
1 parent 300be5e commit c0e1b17
Show file tree
Hide file tree
Showing 9 changed files with 336 additions and 24 deletions.
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
github-artifacts:
patterns:
- actions/*-artifact
minor:
update-types:
- minor
- patch

- package-ecosystem: devcontainers
directory: /
schedule:
interval: weekly
groups:
minor:
update-types:
- minor
- patch

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
groups:
minor:
update-types:
- minor
- patch

- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
groups:
patch:
update-types:
- patch
104 changes: 104 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Backend Code

on:
push:
pull_request:

jobs:
lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
env:
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
steps:
- name: Checkout source
uses: actions/[email protected]

- name: Install dependencies
uses: awalsh128/[email protected]
with:
packages: libopencv-dev clang libclang-dev

- name: Install stable toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
default: true

- name: Cache Rust Build
uses: Swatinem/[email protected]

- name: Create models lib file
run: |
mkdir models/src
printf "\n" > models/src/lib.rs
- name: Check Formatting
uses: actions-rs/[email protected]
with:
command: fmt
args: >
--all
--check
- name: Lint with Clippy
uses: actions-rs/[email protected]
with:
command: clippy
args: >
--no-deps
--all-targets
--all-features
--
--deny warnings
test:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
env:
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
steps:
- name: Checkout source
uses: actions/[email protected]

- name: Install dependencies
uses: awalsh128/[email protected]
with:
packages: libopencv-dev clang libclang-dev

- name: Install stable toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
default: true

- name: Cache Rust Build
uses: Swatinem/[email protected]

- name: Test
uses: actions-rs/[email protected]
with:
command: test
args: >
--all-targets
--all-features
64 changes: 64 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Container

on:
push:
pull_request:

jobs:
build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/[email protected]

- name: Generate Image Name
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
driver-opts: network=host

- name: Build Image
uses: docker/[email protected]
with:
build-args: DATABASE_URL=mysql://root:rootpassword@localhost:3306/ispyb_build
target: deploy
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

23 changes: 23 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dev Container CI

on:
push:
pull_request:

jobs:
build:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Create .env file
run: touch .devcontainer/opa.env

- name: Build dev container
uses: devcontainers/[email protected]
83 changes: 83 additions & 0 deletions .github/workflows/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Schema

on:
push:
pull_request:

jobs:
generate:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
env:
DATABASE_URL: mysql://root:rootpassword@localhost:3306/ispyb_build
steps:
- name: Checkout source
uses: actions/[email protected]

- name: Install stable toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
default: true

- name: Cache Rust Build
uses: Swatinem/[email protected]

- name: Generate Schema
uses: actions-rs/[email protected]
with:
command: run
args: >
schema
--path fluorescence_scan.graphql
- name: Upload Schema Artifact
uses: actions/[email protected]
with:
name: fluorescence_scan.graphql
path: fluorescence_scan.graphql

publish:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
needs:
- generate
runs-on: ubuntu-latest
steps:
- name: Install Rover CLI
run: |
curl -sSL https://rover.apollo.dev/nix/v0.23.0-rc.3 | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Download Schema Artifact
uses: actions/[email protected]
with:
name: fluorescence_scan.graphql

- name: Check Subgraph Schema
run: >
rover subgraph check data-gateway-n63jcf@current
--schema fluorescence_scan.graphql
--name fluorescence-scan
env:
APOLLO_KEY: ${{ secrets.APOLLO_STUDIO }}

- name: Publish Subgraph Schema to Apollo Studio
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
run: >
rover subgraph publish data-gateway-n63jcf@current
--routing-url http://fluorescence-scan:80
--schema fluorescence_scan.graphql
--name fluorescence-scan
env:
APOLLO_KEY: ${{ secrets.APOLLO_STUDIO }}
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions charts/fluorescence_scan/templates/ispyb-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
annotations:
sealedsecrets.bitnami.com/namespace-wide: "true"
creationTimestamp: null
name: flourescence-scan-ispyb
name: fluorescence-scan-ispyb-secret
namespace: graph
spec:
encryptedData:
password: AgAE9My2sdmPfJCuKFPt5O6CBCAGytIlcrChly3IH2s70PlM/B41Lj4dXId1pCGsZkCtx0CTOfDp6+oJbyP0LA8i7qJkZFqBB/bZpsEU3HR/ki/5//xXyepKoUSbFd3Gu3UFNBVZCTqnMClms9HFVyFaoARYKc3gKLO/CqSbFl+7dWurXO4DC0VvQpmHEZ3MVI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8dyUxOeawoO9LT2H22EQOsFgTaLo5hRyM8YnxIumCHC6jn9OULb491MJ371mZc71B7YClSz/hozMtyjN2ZJXALq2vJclXD2uyK28L9EAZF9ywgWJ949vHOezwtSDOfrW+z29atvJVdUaLC7NmzslClssMgdQatd73TdfkfMKMoCD7i8/g==
template:
metadata:
annotations:
sealedsecrets.bitnami.com/namespace-wide: "true"
creationTimestamp: null
name: flourescence-scan-ispyb
name: fluorescence-scan-ispyb-secret
namespace: graph

Loading

0 comments on commit c0e1b17

Please sign in to comment.