From 5a28a0cf787b5cf5f5c3fb265bf3f4665da83ea1 Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Sun, 13 Mar 2022 02:06:06 +0000 Subject: [PATCH] appveyor: Add build scripts and remove circleci --- .circleci/config.yml | 23 -------------- appveyor.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 23 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 appveyor.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 1b05946..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 -jobs: - run_tester: - docker: - - image: circleci/node:latest - working_directory: ~/flaska - steps: - - checkout - - run: - name: Install dependencies - command: | - npm install - npm list --all - - run: - name: Run tests - command: | - npm test - -workflows: - version: 2 - build_deploy: - jobs: - - run_tester diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..cd6db72 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,72 @@ +# version format +version: '{build}' +deploy: on + +# branches to build +branches: + # whitelist + only: + - master + +# Do not build on tags (GitHub, Bitbucket, GitLab, Gitea) +skip_tags: true + +# Maximum number of concurrent jobs for the project +max_jobs: 1 +clone_depth: 1 + +# Build worker image (VM template) +build_cloud: Docker + +environment: + docker_image: node:17-alpine + +test_script: + - sh: | + mkdir /lib64 + ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 + chmod -R 777 /appveyor/projects + npm install + npm run test -- --ignore-only + if [ $? -ne 0 ]; then + exit 1 + fi + +artifacts: + - path: ./*_sc-core.7z + +# on successful build +on_success: + - sh: | + apk add curl jq + if [ $? -eq 0 ]; then + echo "Finished installling curl and jq" + else + exit 1 + fi + CURR_VER=$(cat package.json | jq -r .version) + echo "Checking https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases for version v${CURR_VER}" + curl -s -X GET -H "Authorization: token $deploytoken" https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases | grep -o "\"name\"\:\"v${CURR_VER}\"" > /dev/null + + if [ $? -eq 0 ] ; then + echo "Release already exists, nothing to do."; + else + ./test/7zas a -mx9 "${CURR_VER}_sc-core.7z" package.json index.mjs cli.mjs core bin + echo "Creating release on gitea" + RELEASE_RESULT=$(curl \ + -X POST \ + -H "Authorization: token $deploytoken" \ + -H "Content-Type: application/json" \ + https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases \ + -d "{\"tag_name\":\"v${CURR_VER}\",\"name\":\"v${CURR_VER}\",\"body\":\"Automatic release from Appveyor from ${APPVEYOR_REPO_COMMIT} :\n\n${APPVEYOR_REPO_COMMIT_MESSAGE}\"}") + RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id) + echo "Adding ${CURR_VER}_sc-core.7z to release ${RELEASE_ID}" + curl \ + -X POST \ + -H "Authorization: token $deploytoken" \ + -F "attachment=@${CURR_VER}_sc-core.7z" \ + https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases/$RELEASE_ID/assets + echo '//registry.npmjs.org/:_authToken=${npmtoken}' > ~/.npmrc + echo "Publishing new version to npm" + npm publish + fi