blob: 7d1269b213f0df55c5cf0f428839148522c4f417 [file] [log] [blame]
image: node:latest
stages:
- test
- build
- deploy
cache:
paths:
- node_modules/
# Run npm tests
test:
stage: test
before_script:
- npm install
script:
- npm test
# Test Docker image build
test-docker-image:
image: docker:latest
stage: test
variables:
FF_NETWORK_PER_BUILD: "true"
services:
- name: docker:dind
alias: docker
command: ["--dns=127.0.0.11", "--dns=8.8.8.8"]
before_script:
- apk update
- apk add --no-cache bash
script:
- docker build -t korap/conllu-cmc:test .
- echo "Testing help display..."
- docker run --rm korap/conllu-cmc:test --help
- echo "Testing basic annotation..."
- echo -e "1\tšŸ˜€\t_\t_\t_\t_\t_\t_\t_\t_" | docker run --rm -i korap/conllu-cmc:test
# Build Docker image
build-docker-image:
image: docker:latest
stage: build
variables:
FF_NETWORK_PER_BUILD: "true"
services:
- name: docker:dind
alias: docker
command: ["--dns=127.0.0.11", "--dns=8.8.8.8"]
rules:
- if: $CI_COMMIT_TAG =~ /.+/
variables:
VID: $CI_COMMIT_TAG
- when: manual
variables:
VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
VID: snapshot
cache:
key: conllu-cmc
paths:
- cache/
before_script:
- mkdir -p cache
- apk update
- apk add --no-cache bash xz
script:
- docker build -t korap/conllu-cmc:latest .
- docker tag korap/conllu-cmc:latest korap/conllu-cmc:$VID
- |
if [ -n "$VID_ALT" ]; then
docker tag korap/conllu-cmc:latest korap/conllu-cmc:$VID_ALT
fi
- docker save korap/conllu-cmc | xz -T0 > conllu-cmc.xz
artifacts:
paths:
- conllu-cmc.xz
# Deploy to Docker Hub
deploy-to-docker-hub:
image: docker:latest
stage: deploy
variables:
FF_NETWORK_PER_BUILD: "true"
services:
- name: docker:dind
alias: docker
command: ["--dns=127.0.0.11", "--dns=8.8.8.8"]
rules:
- if: $CI_COMMIT_TAG =~ /.+/
- when: manual
dependencies:
- build-docker-image
before_script:
- echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USER" --password-stdin
script:
- xz -d -c conllu-cmc.xz | docker load
- docker push --all-tags korap/conllu-cmc
# Build standalone binaries
package:
stage: build
before_script:
- npm install
script:
- npm run pkg-linux
- npm run pkg-macos
artifacts:
paths:
- bin/