Skip to content

Commit

Permalink
Lots of CI adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored and Ancient123 committed Oct 8, 2024
1 parent 1c755ae commit ce94de8
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 39 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2

- name: Format Check
run: cargo fmt -- --check

#- name: Check
# run: cargo clippy

#- name: Test
# run: cargo test

- name: Build
run: cargo build
51 changes: 28 additions & 23 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ name: Docker

on:
push:
branches: [ "main" ]
branches:
- "main"
pull_request:
branches: [ "main" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Use docker.io for Docker Hub if empty
Expand All @@ -22,35 +27,35 @@ jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
#permissions:
#contents: read
#packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
#id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.1.1
with:
cosign-release: 'v1.13.1'
#- name: Install cosign
# if: github.event_name != 'pull_request'
# uses: sigstore/cosign-installer@v3
# with:
# cosign-release: 'v1.13.1'


# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -60,7 +65,7 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
Expand All @@ -70,7 +75,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -86,10 +91,10 @@ jobs:
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
#- name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
30 changes: 15 additions & 15 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async fn rpc_call(

for (index, mut response) in result_values.into_iter().enumerate() {
let rpc_request = match RequestId::try_from(response["id"].clone()) {
Ok(id) if request_id_index_map.get(&id).is_some() => {
Ok(id) if request_id_index_map.contains_key(&id) => {
&uncached_requests[*request_id_index_map.get(&id).unwrap()]
}
_ => {
Expand Down

0 comments on commit ce94de8

Please sign in to comment.