-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
955045b
commit 6f0b635
Showing
1 changed file
with
89 additions
and
89 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
--- | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
jobs: | ||
formatting-and-quality: | ||
name: Formatting and Quality | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v7 | ||
- uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
# Evaluate the devshell here so that the time reported for subsequent | ||
# steps that use it reflect what is actually done there. | ||
- name: Evaluate devshell | ||
run: nix develop | ||
|
||
- name: Format | ||
run: nix develop --command treefmt --fail-on-change | ||
|
||
- name: Clippy | ||
run: nix develop --command cargo clippy --all-targets | ||
|
||
- name: Repository cleanliness | ||
run: git diff --exit-code | ||
|
||
- name: Test | ||
run: nix build -L --no-sandbox .#test | ||
|
||
build: | ||
name: Build | ||
needs: | ||
- formatting-and-quality | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
package: | ||
- events-to-histogram | ||
- kafka-daq-report | ||
- simulator | ||
- stream-to-file | ||
- trace-archiver | ||
- trace-to-events | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v7 | ||
- uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
# Evaluate the devshell here so that the time reported for subsequent | ||
# steps that use it reflect what is actually done there. | ||
- name: Evaluate devshell | ||
run: nix develop | ||
- name: Build | ||
run: nix build -L .#${{ matrix.package }} | ||
- name: Build and push container image | ||
if: ${{ github.ref_name == 'main' || github.ref_type == 'tag' }} | ||
run: | | ||
set -x | ||
# Build image via Nix and take the resulting path as the local container registry | ||
local_cr="docker-archive://$(nix build .#${{ matrix.package }}-container-image --no-link --print-out-paths)" | ||
# The container registry to push images to (GHCR) | ||
remote_cr="docker://ghcr.io/stfc-icd-research-and-design/supermusr-${{ matrix.package }}" | ||
remote_cr_creds="${{ github.repository_owner }}:${{ github.token }}" | ||
# Push image using the Git ref name as the image tag (i.e. "main" or the tag name) | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:${{ github.ref_name }}" | ||
# Push image using the Git SHA as the image tag | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:${{ github.sha }}" | ||
# If the trigger was a tag (i.e. a release) | ||
if [[ "${{ github.ref_type }}" == 'tag' ]]; then | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:latest" | ||
fi | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
|
||
jobs: | ||
formatting-and-quality: | ||
name: Formatting and Quality | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v7 | ||
- uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
# Evaluate the devshell here so that the time reported for subsequent | ||
# steps that use it reflect what is actually done there. | ||
- name: Evaluate devshell | ||
run: nix develop | ||
|
||
- name: Format | ||
run: nix develop --command treefmt --fail-on-change | ||
|
||
- name: Clippy | ||
run: nix develop --command cargo clippy --all-targets | ||
|
||
- name: Repository cleanliness | ||
run: git diff --exit-code | ||
|
||
- name: Test | ||
run: nix build -L --no-sandbox .#test | ||
|
||
build: | ||
name: Build | ||
needs: | ||
- formatting-and-quality | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
package: | ||
- events-to-histogram | ||
- kafka-daq-report | ||
- simulator | ||
- stream-to-file | ||
- trace-archiver | ||
- trace-reader | ||
- trace-to-events | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v7 | ||
- uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
# Evaluate the devshell here so that the time reported for subsequent | ||
# steps that use it reflect what is actually done there. | ||
- name: Evaluate devshell | ||
run: nix develop | ||
|
||
- name: Build | ||
run: nix build -L .#${{ matrix.package }} | ||
|
||
- name: Build and push container image | ||
if: ${{ github.ref_name == 'main' || github.ref_type == 'tag' }} | ||
run: | | ||
set -x | ||
# Build image via Nix and take the resulting path as the local container registry | ||
local_cr="docker-archive://$(nix build .#${{ matrix.package }}-container-image --no-link --print-out-paths)" | ||
# The container registry to push images to (GHCR) | ||
remote_cr="docker://ghcr.io/stfc-icd-research-and-design/supermusr-${{ matrix.package }}" | ||
remote_cr_creds="${{ github.repository_owner }}:${{ github.token }}" | ||
# Push image using the Git ref name as the image tag (i.e. "main" or the tag name) | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:${{ github.ref_name }}" | ||
# Push image using the Git SHA as the image tag | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:${{ github.sha }}" | ||
# If the trigger was a tag (i.e. a release) | ||
if [[ "${{ github.ref_type }}" == 'tag' ]]; then | ||
skopeo copy --dest-creds="$remote_cr_creds" "$local_cr" "$remote_cr:latest" | ||
fi |