Skip to content

Commit

Permalink
1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Nov 20, 2023
1 parent 5f3c11e commit c4d2b8a
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 33 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_run:
workflows: [nextest]
branches: [main]
types:
- completed
# schedule:
# - cron: 0 0 * * 1
# push:
# branches: [ "main" ]
# # Publish semver tags as releases.
# tags: [ 'v*.*.*' ]
# pull_request:
# branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

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

# 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@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
with:
cosign-release: "v2.1.1"

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# 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@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# https://github.com/orgs/community/discussions/25768#discussioncomment-3249183
- name: downcase REPO
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
# tags: ${{ steps.meta.outputs.tags }}
# tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest
tags: ${{ env.REGISTRY }}/${{ env.REPO }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# # Sign the resulting Docker image digest except on PRs.
# # This will only write to the public Rekor transparency log when the Docker
# # 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:
# # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
# TAGS: ${{ steps.meta.outputs.tags }}
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
80 changes: 47 additions & 33 deletions .github/workflows/nextest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
name: nextest

on:
# pull_request:
# branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
schedule:
# Run this every day at 00:00 UTC.
- cron: 0 0 * * *
- cron: 0 0 * * 1

env:
CARGO_TERM_COLOR: always

jobs:
build-test-artifacts:
name: Build test artifacts
build-test:
name: Build test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -29,44 +28,59 @@ jobs:
toolchain: stable
override: true
# - uses: rui314/setup-mold@v1
- name: clang
- name: install mold
run: sudo apt-get install -y musl-tools musl-dev libssl-dev clang mold
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Build and archive tests
run: cargo nextest archive --archive-file nextest-archive.tar.zst
- name: Upload archive to workflow
uses: actions/upload-artifact@v3
with:
name: nextest-archive
path: nextest-archive.tar.zst
# - name: Build and archive tests
# run: cargo nextest archive --archive-file nextest-archive.tar.zst
# - name: Upload archive to workflow
# uses: actions/upload-artifact@v3
# with:
# name: nextest-archive
# path: nextest-archive.tar.zst

run-tests-partitioned:
name: Run tests with partitioning
run-tests:
name: Run tests
runs-on: ubuntu-latest
needs: build-test-artifacts
strategy:
matrix:
partition: [1, 2]
needs: build-test
steps:
# The source directory must be checked out.
- uses: actions/checkout@v2
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
# In this example, the Rust toolchain is not installed. cargo nextest's run phase does not
# require Cargo. You can choose to install Rust if your tests require it, of course.
# Instead, create ~/.cargo/bin as required by the install action.
- run: mkdir -p ~/.cargo/bin
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive
- name: Run tests
run: |
~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.partition }}/2 \
-E "all() - test(get_api) - kind(bin)"
~/.cargo/bin/cargo-nextest nextest run -E "all() - test(get_api) - kind(bin)"
# run-tests-partitioned:
# name: Run tests with partitioning
# runs-on: ubuntu-latest
# needs: build-test
# strategy:
# matrix:
# partition: [1, 2]
# steps:
# # The source directory must be checked out.
# - uses: actions/checkout@v2
# with:
# # By default actions/checkout checks out a merge commit. Check out the PR head instead.
# # https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
# ref: ${{ github.event.pull_request.head.sha }}
# # In this example, the Rust toolchain is not installed. cargo nextest's run phase does not
# # require Cargo. You can choose to install Rust if your tests require it, of course.
# # Instead, create ~/.cargo/bin as required by the install action.
# - run: mkdir -p ~/.cargo/bin
# - name: Install nextest
# uses: taiki-e/install-action@nextest
# - name: Download archive
# uses: actions/download-artifact@v3
# with:
# name: nextest-archive
# - name: Run tests
# run: |
# ~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst \
# --partition count:${{ matrix.partition }}/2 \
# -E "all() - test(get_api) - kind(bin)"

0 comments on commit c4d2b8a

Please sign in to comment.