This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
Remove grcov #3567
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: safe-client-gateway | |
on: [ push, pull_request ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-02-18 | |
override: true | |
components: rustfmt | |
- name: Run rustfmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all --check | |
tests: | |
runs-on: ubuntu-20.04 | |
services: | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
env: | |
RUSTC_BOOTSTRAP: 1 # grcov requires a nightly build. See https://github.com/mozilla/grcov#usage | |
REDIS_URI: redis://localhost:6379 | |
REDIS_URI_MAINNET: redis://localhost:6379 | |
WEBHOOK_TOKEN: test_webhook_token | |
CONFIG_SERVICE_URI: https://config.service.url | |
VPC_TRANSACTION_SERVICE_URI: 'false' | |
SCHEME: http | |
TRANSACTION_SERVICE_AUTH_TOKEN: some_other_random_token | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
# This can be removed once https://github.com/actions-rs/toolchain/pull/209 is merged and released | |
- name: Set variables | |
run: | | |
echo "TOOLCHAIN=$(rustup show active-toolchain | cut -d " " -f1)" >> $GITHUB_ENV | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.TOOLCHAIN }} | |
override: true | |
- name: Cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all --locked -- --test-threads 1 | |
env: | |
CARGO_INCREMENTAL: '0' | |
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Awarnings' | |
docs: | |
runs-on: ubuntu-20.04 | |
needs: [ rustfmt, tests ] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # checks out all branches and tags, necessary for versioning /about endpoint | |
- name: Set variables | |
run: | | |
echo "TOOLCHAIN=$(rustup show active-toolchain | cut -d " " -f1)" >> $GITHUB_ENV | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ env.TOOLCHAIN }} | |
override: true | |
components: rustfmt | |
- name: Cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Generate docs | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --no-deps --workspace --locked | |
- name: Move folder | |
run: | | |
rm -rf target/doc/docs | |
mv target/doc/safe_client_gateway target/doc/docs | |
cp .github/landing_page/* target/doc | |
- name: Fix internal links | |
run: find ./target/doc/docs/ -type f -exec sed -i "s/safe_client_gateway/docs/g" {} \; | |
- name: Update docs | |
uses: peaceiris/actions-gh-pages@v3.9.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./target/doc | |
docker-publish-staging: | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
needs: [ rustfmt, tests ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
# This is needed for the "Set Version" step as we need to fetch the available tags | |
fetch-depth: '0' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2.1.0 | |
with: | |
platforms: arm64 | |
- name: Set Version | |
run: | | |
description="$(git describe --tags --always)" | |
echo "VERSION=${description:1}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2.5.0 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2.1.0 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: VERSION=${{ env.VERSION }} | |
tags: safeglobal/safe-client-gateway:staging | |
cache-from: type=registry,ref=safeglobal/safe-client-gateway:staging | |
cache-to: type=inline | |
deploy: | |
runs-on: ubuntu-20.04 | |
env: | |
DOCKERHUB_ORG: safeglobal | |
DOCKERHUB_PROJECT: safe-client-gateway | |
needs: [ rustfmt, tests ] | |
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # checks out all branches and tags, necessary for versioning /about endpoint | |
- name: Dockerhub login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Deploy main | |
if: github.ref == 'refs/heads/main' | |
run: bash scripts/deploy_docker.sh staging | |
- name: Deploy tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: bash scripts/deploy_docker.sh ${GITHUB_REF##*/} | |
- name: Deploy develop # unused | |
if: github.ref == 'refs/heads/develop' | |
run: bash scripts/deploy_docker.sh develop | |
autodeploy: | |
runs-on: ubuntu-20.04 | |
needs: [ docker-publish-staging ] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Deploy staging | |
run: bash scripts/autodeploy.sh | |
env: | |
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }} | |
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }} | |
TARGET_ENV: "staging" |