Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Update dependency bazel_gazelle to v0.31.0 #306

Update dependency bazel_gazelle to v0.31.0

Update dependency bazel_gazelle to v0.31.0 #306

Workflow file for this run

---
name: Build
on: push
jobs:
lint-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3.5.2
- name: Mount bazel cache
uses: actions/cache@v3.3.1
with:
path: "~/.cache/bazel"
key: lint-bazel
- run: bazel run //:buildifier
- name: Sync bazel with go deps
run: |
bazel run //:gazelle
bazel run //:gazelle-update-repos
- name: Check repos dirty state
id: gitdirty
run: |
git update-index -q --ignore-submodules --refresh
git diff-files --quiet --ignore-submodules
git diff-index --cached --quiet --ignore-submodules HEAD --
- name: Show changed files
if: ${{ failure() && steps.gitdirty.conclusion == 'failure' }}
run: |
git diff
git diff --cached
lint-golangci-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3.5.2
- uses: actions/setup-go@v4.0.0
with:
go-version: "1.20.2"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.52.2
lint-super-linter:
runs-on: ubuntu-22.04
steps:
- uses: github/super-linter/slim@v5.0.0
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GO: false
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3.5.2
with:
fetch-depth: 0
- name: Mount bazel cache
uses: actions/cache@v3.3.1
with:
path: "~/.cache/bazel"
key: bazel-build
- run: |
bazel build //...
bazel build //:image.tar
- name: Prepare artifact
# Artifact upload do not support symlinked folder bazel-bin
run: ln bazel-bin/image.tar dummy-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v3.1.2
if: startsWith(github.ref, 'refs/tags/')
with:
name: dummy-image
path: dummy-image.tar
if-no-files-found: error
deploy:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
- lint-bazel
- lint-golangci-lint
- lint-super-linter
env:
AWS_ACCESS_KEY_ID: "${{ secrets.SCW_ACCESS_KEY }}"
AWS_SECRET_ACCESS_KEY : "${{ secrets.SCW_SECRET_KEY }}"
SCW_ACCESS_KEY: "${{ secrets.SCW_ACCESS_KEY }}"
SCW_SECRET_KEY : "${{ secrets.SCW_SECRET_KEY }}"
steps:
- uses: actions/checkout@v3.5.2
- name: Download artifact
uses: actions/download-artifact@v3.0.2
with:
name: dummy-image
path: /tmp
- name: Load image
run: |
docker load --input /tmp/dummy-image.tar
- name: Compute serverless registry variables
id: registry
run: |
cd deployments/terraform
terraform init
tag="gh-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
name="$(terraform output -raw registry)/dummy"
cat >> "${GITHUB_OUTPUT}" << EOT
registry_endpoint=$(terraform output -raw registry)
image_tag=${tag}
image_name=${name}
image_full=${name}:${tag}
EOT
- name: Deploy docker image to the serverless registry
run: |
docker login "${{ steps.registry.outputs.registry_endpoint }}" \
--username nologin \
--password "${{ secrets.SCW_SECRET_KEY }}"
docker tag bazel:image "${{ steps.registry.outputs.image_full }}"
docker push "${{ steps.registry.outputs.image_full }}"
- name: Deploy on docker container serverless
run: |
cd deployments/terraform
terraform apply -auto-approve -var "image_tag=${{ steps.registry.outputs.image_tag }}"