Skip to content

fix(ci): fix syntax #20

fix(ci): fix syntax

fix(ci): fix syntax #20

Workflow file for this run

---
name: CI/CD for Nix Dotfiles
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-docker-image:
if: |
(github.event_name == 'push' || github.event_name == 'pull_request') &&
(contains(github.event.head_commit.modified, 'nix_test_env/Dockerfile') ||
contains(github.event.head_commit.added, 'nix_test_env/Dockerfile') ||
contains(github.event.head_commit.added, 'nix_test_env/docker_entrypoint.sh') ||
contains(github.event.head_commit.modified, 'nix_test_env/docker_entrypoint.sh'))
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.build.outputs.image_name }}
build_ran: "true"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Build docker image
id: build
run: |
IMAGE_NAME="nix-test-env:$(git rev-parse --short HEAD)"
docker build -t ${IMAGE_NAME} -f ./nix_test_env/Dockerfile .
echo "image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
- name: Save Docker image
run: |
docker save ${{ steps.build.outputs.image_name }} -o nix-image.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: nix-docker-image
path: nix-image.tar
debug:
steps:

Check failure on line 47 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI/CD for Nix Dotfiles

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 47, Col: 5): Required property is missing: runs-on
- name: Debug event
run: |
echo "Event name: ${{ github.event_name }}"
echo "Modified files: ${{ github.event.head_commit.modified }}"
echo "Added files: ${{ github.event.head_commit.added }}"
tests:
runs-on: ubuntu-latest
if: |
(github.event_name == 'push' || github.event_name == 'pull_request') &&
(needs.build-docker-image.outputs.build_ran == 'true' ||
needs.build-docker-image.outputs.build_ran == '')
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download Docker image artifact
if: needs.build-docker-image.outputs.build_ran == 'true'
uses: actions/download-artifact@v4
with:
name: nix-docker-image
- name: Load Docker image
if: needs.build-docker-image.outputs.build_ran == 'true'
run: |
docker load -i nix-image.tar
- name: Run container
id: container
run: |
CONTAINER_NAME="nix-test-container"
docker run --name ${CONTAINER_NAME} -d \
--entrypoint /usr/local/bin/docker_entrypoint.sh \
${{ needs.build-docker-image.outputs.image_name }} tail -f /dev/null
echo "container_name=${CONTAINER_NAME}" >> $GITHUB_OUTPUT
- name: Run home-manager switch
run: |
docker exec ${{ steps.container.outputs.container_name }} bash \
home-manager switch
- name: Run Git config test in container
run: |
docker exec ${{ steps.container.outputs.container_name }} bash -ec "
git config --global user.name | grep -q 'PedroBrantes'
"
- name: Run Editor env test in container
run: |
docker exec ${{ steps.container.outputs.container_name }} bash -ec "
printenv EDITOR | grep -q 'nvim'
"
- name: Clean up container
run: docker rm -f ${{ steps.container.outputs.container_name }}