diff --git a/.github/workflows/nim.yml b/.github/workflows/nim.yml index e509b00d..cd6b380f 100644 --- a/.github/workflows/nim.yml +++ b/.github/workflows/nim.yml @@ -27,7 +27,9 @@ jobs: runs-on: ubuntu-latest needs: before steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + - name: Build docker image + run: docker compose -f compose.test.yaml build app-ubuntu-v1 - name: Test run: docker compose -f compose.test.yaml run app-ubuntu-v1 nimble test @@ -35,9 +37,11 @@ jobs: runs-on: ubuntu-latest needs: before steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + - name: Build docker image + run: docker compose -f compose.test.yaml build app-ubuntu-v2 - name: Test - run: docker compose -f compose.test.yaml run app-ubuntu nimble test + run: docker compose -f compose.test.yaml run app-ubuntu-v2 nimble test # アプリケーションの方を使うことにした diff --git a/compose.test.yaml b/compose.test.yaml index 33c05bce..94a70664 100644 --- a/compose.test.yaml +++ b/compose.test.yaml @@ -1,11 +1,10 @@ -version: '3' services: app-ubuntu-v1: build: context: . - dockerfile: ./docker/ubuntu/Dockerfile + dockerfile: ./docker/ubuntu/test.Dockerfile args: - VERSION: 1.6.16 + NIM_VERSION: 1.6.20 tty: true volumes: - .:/root/project @@ -15,12 +14,12 @@ services: - mariadb - surreal - app-ubuntu: + app-ubuntu-v2: build: context: . - dockerfile: ./docker/ubuntu/Dockerfile + dockerfile: ./docker/ubuntu/test.Dockerfile args: - VERSION: 2.0.0 + NIM_VERSION: 2.2.0 tty: true volumes: - .:/root/project @@ -33,12 +32,11 @@ services: mysql: image: mysql:8 tty: true - command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: database MYSQL_USER: user MYSQL_PASSWORD: pass + MYSQL_ROOT_PASSWORD: pass mariadb: image: mariadb diff --git a/compose.yaml b/compose.yaml index c9dd2352..7fb1ccdb 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,25 +1,11 @@ -version: '3' services: - # app-alpine: - # build: - # context: . - # dockerfile: ./docker/alpine/Dockerfile - # tty: true - # environment: - # TZ: Asia/Tokyo - # volumes: - # - .:/root/project - # depends_on: - # - mariadb - # - postgres - app-ubuntu: build: context: . dockerfile: ./docker/ubuntu/Dockerfile args: # VERSION: 1.6.14 - VERSION: 2.0.0 + NIM_VERSION: 2.2.0 tty: true volumes: - .:/root/project @@ -32,12 +18,11 @@ services: mysql: image: mysql:8 tty: true - command: --default-authentication-plugin=mysql_native_password environment: - MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: database MYSQL_USER: user MYSQL_PASSWORD: pass + MYSQL_ROOT_PASSWORD: pass mariadb: image: mariadb @@ -47,7 +32,6 @@ services: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: database MYSQL_USER: user - MYSQL_PASSWORD: pass postgres: image: postgres:alpine @@ -69,7 +53,7 @@ services: image: adminer:4.8.1-standalone tty: true ports: - - 9002:8080 + - 9001:8080 depends_on: - mysql - mariadb @@ -79,19 +63,8 @@ services: build: ./docker/adminer tty: true ports: - - 9003:8080 + - 9002:8080 volumes: - ./:/app depends_on: - app-ubuntu - - phpmyadmin: - image: phpmyadmin - tty: true - environment: - - PMA_ARBITRARY=1 - ports: - - "9004:80" - depends_on: - - mysql - - mariadb diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile index 2e9454f5..c8b8f2eb 100644 --- a/docker/ubuntu/Dockerfile +++ b/docker/ubuntu/Dockerfile @@ -1,33 +1,45 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 # prevent timezone dialogue ENV DEBIAN_FRONTEND=noninteractive -RUN apt update; apt install -y libgnutls30 -RUN apt update; \ - apt upgrade -y +RUN apt update +RUN apt upgrade -y RUN apt install -y \ - gcc \ - xz-utils \ - ca-certificates \ - vim \ - curl \ - wget \ - git \ - sqlite3 \ - libpq-dev \ - libmariadb-dev + gcc \ + xz-utils \ + ca-certificates \ + libpcre3-dev \ + vim \ + curl \ + git \ + sqlite3 \ + libpq-dev \ + libmariadb-dev -# ===== Nim ===== -ARG VERSION="2.0.0" +# gcc... for Nim +# xz-utils... for unzip tar.xz +# ca-certificates... for https +# libpcre3-dev... for nim regex + +# Nim +ARG NIM_VERSION="2.0.0" WORKDIR /root RUN curl https://nim-lang.org/choosenim/init.sh -o init.sh RUN sh init.sh -y RUN rm -f init.sh ENV PATH $PATH:/root/.nimble/bin -RUN choosenim ${VERSION} +RUN choosenim ${NIM_VERSION} + +# nimlangserver +WORKDIR /root +RUN curl -o nimlangserver.tar.gz -L https://github.com/nim-lang/langserver/releases/download/v1.6.0/nimlangserver-1.6.0-linux-amd64.tar.gz +RUN tar zxf nimlangserver.tar.gz +RUN rm -f nimlangserver.tar.gz +RUN mv nimlangserver /root/.nimble/bin/ WORKDIR /root/project COPY ./allographer.nimble . RUN nimble install -y -d + RUN git config --global --add safe.directory /root/project diff --git a/docker/ubuntu/test.Dockerfile b/docker/ubuntu/test.Dockerfile new file mode 100644 index 00000000..729981e7 --- /dev/null +++ b/docker/ubuntu/test.Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:24.04 + +# prevent timezone dialogue +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt update +RUN apt upgrade -y +RUN apt install -y \ + gcc \ + xz-utils \ + ca-certificates \ + libpcre3-dev \ + curl \ + git \ + sqlite3 \ + libpq-dev \ + libmariadb-dev + +# gcc... for Nim +# xz-utils... for unzip tar.xz +# ca-certificates... for https +# libpcre3-dev... for nim regex + +# Nim +ARG NIM_VERSION="2.0.0" +WORKDIR /root +RUN curl https://nim-lang.org/choosenim/init.sh -o init.sh +RUN sh init.sh -y +RUN rm -f init.sh +ENV PATH $PATH:/root/.nimble/bin +RUN choosenim ${NIM_VERSION} + +WORKDIR /root/project +COPY ./allographer.nimble . +RUN nimble install -y -d + +RUN git config --global --add safe.directory /root/project + +WORKDIR /root/project diff --git a/permission.sh b/permission.sh index 59e4eed7..99bc322a 100755 --- a/permission.sh +++ b/permission.sh @@ -4,5 +4,5 @@ local_GID=$(id -g $USER) echo 'start' sudo chown ${local_UID}:${local_GID} * -R echo '======================' -sudo chown ${local_UID}:${local_GID} .git -R +sudo chown ${local_UID}:${local_GID} .* -R echo 'end' diff --git a/tests/v2/mysql/test_query.nim b/tests/v2/mysql/test_query.nim index 069c05b1..724c3645 100644 --- a/tests/v2/mysql/test_query.nim +++ b/tests/v2/mysql/test_query.nim @@ -2,6 +2,8 @@ discard """ cmd: "nim c -d:reset -d:ssl -r $file" """ +# nim c -d:reset -d:ssl -r tests/v2/mysql/test_query.nim + import std/unittest import std/asyncdispatch import std/httpclient