Skip to content

Commit

Permalink
ci: Build container image
Browse files Browse the repository at this point in the history
Test Plan
=========

CI
  • Loading branch information
javierhonduco committed May 7, 2024
1 parent b49f76d commit 67dd8af
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build container image
on:
pull_request:
push:

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

jobs:
container:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
packages: write

steps:
- uses: actions/checkout@main
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Set up nix dev env
run: nix develop --command echo 0
- name: Build container image
run: nix build .#container
- name: Push container image on commits to main
if: ${{ github.ref_name == 'main' }}
run: |
nix develop --ignore-environment --command skopeo copy --dest-creds="${{ github.repository_owner }}:${{ github.token }}" docker-archive:./result docker://ghcr.io/javierhonduco/lightswitch:main-${{ github.sha }}
- name: Push container image on new releases
if: ${{ github.ref_type == 'tag' }}
run: |
nix develop --ignore-environment --command skopeo copy --dest-creds="${{ github.repository_owner }}:${{ github.token }}" docker-archive:./result docker://ghcr.io/javierhonduco/lightswitch:${{ github.ref_name }}
nix develop --ignore-environment --command skopeo copy --dest-creds="${{ github.repository_owner }}:${{ github.token }}" docker-archive:./result docker://ghcr.io/javierhonduco/lightswitch:latest
4 changes: 2 additions & 2 deletions .github/workflows/static-build-and-upload.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: static build and upload
on:
pull_request:
push:
pull_request:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vmtests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: vmtests
on:
pull_request:
push:
pull_request:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
default = lightswitch;
container = pkgs.dockerTools.buildLayeredImage {
name = "lightswitch";
tag = "${self.dirtyShortRev}";
config = {
Cmd = [ "${lightswitch}/bin/lightswitch" ];
Env = [
Expand All @@ -75,6 +74,7 @@
gdb
openssl
# Other tools
skopeo
cargo-edit
# snapshot testing plugin binary
cargo-insta
Expand Down

0 comments on commit 67dd8af

Please sign in to comment.