Skip to content

Commit 7925bd2

Browse files
cuducosEduardo Vicente Gonçalves
authored andcommitted
Creates container for tests
1 parent a172816 commit 7925bd2

File tree

4 files changed

+98
-15
lines changed

4 files changed

+98
-15
lines changed

.github/workflows/container.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Container
2+
on:
3+
push:
4+
branches: ['main']
5+
6+
jobs:
7+
build-and-push-image:
8+
env:
9+
IMAGE_NAME: ${{ github.repository }}
10+
REGISTRY: ghcr.io
11+
permissions:
12+
contents: read
13+
packages: write
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
neovim: [stable, nightly]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v2
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@v4
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-neovim-${{ matrix.neovim }}
35+
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v4
38+
with:
39+
context: .
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/stylua.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
on: [push, pull_request]
3+
name: Stylua
4+
5+
jobs:
6+
7+
stylua:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
nvim-versions: ["stable", "nightly"]
12+
name: Stylua
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: JohnnyMorganz/stylua-action@v2
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
version: latest
19+
args: --check .

.github/workflows/tests.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
---
22
on: [push, pull_request]
3-
name: main
3+
name: Tests
44

55
jobs:
66

7-
stylua:
8-
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
nvim-versions: ["stable", "nightly"]
12-
name: Stylua
13-
steps:
14-
- uses: actions/checkout@v3
15-
- uses: JohnnyMorganz/stylua-action@v2
16-
with:
17-
token: ${{ secrets.GITHUB_TOKEN }}
18-
version: latest
19-
args: --check .
20-
217
tests:
228
runs-on: ubuntu-latest
239
strategy:

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM debian:bullseye-slim AS neovim
2+
ARG NVIM_VERSION
3+
ENV NVIM_VERSION=${NVIM_VERSION:-stable}
4+
ENV BUILD_REQUIREMENTS "cmake curl gcc gettext git ninja-build unzip"
5+
RUN apt-get update && \
6+
apt-get install -y ${BUILD_REQUIREMENTS} && \
7+
git clone --branch ${NVIM_VERSION} https://github.com/neovim/neovim && \
8+
cd neovim && \
9+
make install && \
10+
rm -rf ../neovim && \
11+
apt-get remove -y ${BUILD_REQUIREMENTS} && \
12+
apt-get autoremove -y && \
13+
rm -rf /var/lib/apt/lists/*
14+
15+
FROM rust:slim-bullseye AS tree-sitter-cli
16+
RUN cargo install tree-sitter-cli
17+
18+
FROM debian:bullseye-slim
19+
COPY --from=neovim /usr/local/share/nvim /usr/local/share/nvim
20+
COPY --from=neovim /usr/local/lib/nvim /usr/local/lib/nvim
21+
COPY --from=neovim /usr/local/bin/nvim /usr/local/bin/nvim
22+
COPY --from=tree-sitter-cli /usr/local/cargo/bin/tree-sitter /usr/local/bin/tree-sitter
23+
24+
RUN apt-get update && \
25+
apt-get install -y curl g++ git && \
26+
apt-get autoremove -y && \
27+
rm -rf /var/lib/apt/lists/* && \
28+
useradd -ms /bin/bash yaml
29+
30+
USER yaml
31+
WORKDIR /home/yaml/
32+
RUN mkdir -p .config/nvim/
33+
ADD tests/init.lua .config/nvim/init.lua
34+
ADD . .
35+
36+
CMD ["nvim", "--headless", "-c", "PlenaryBustedDirectory tests/yaml_nvim { minimal_init = 'tests/init.lua' }"]

0 commit comments

Comments
 (0)