From 03ba7cb68cccc179017135a337291196ad0fac60 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Mon, 15 Nov 2021 10:13:50 +0100 Subject: [PATCH 1/3] Added new testing pipeline --- .github/workflows/node.js.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..99e76018 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + pull_request: + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm i --no-optional + - run: wget -q -O factorio.tar.gz https://www.factorio.com/get-download/latest/headless/linux64 && tar -xf factorio.tar.gz && rm factorio.tar.gz + - run: npx lerna bootstrap --hoist + - run: npx lerna run build + - run: npm test From 56584a25c8415a4aba6fea93af437690ab197e4b Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Mon, 15 Nov 2021 10:26:32 +0100 Subject: [PATCH 2/3] Remove old pipeline --- .github/workflows/docker-publish.yml | 159 --------------------------- 1 file changed, 159 deletions(-) delete mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index f868a8b9..00000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Docker - -on: - push: - # Publish `master` as Docker `latest` image. - branches: - - '**' - - # Publish `v1.2.3` tags as releases. - tags: - - v* - - # Run tests for any PRs. - pull_request: - - release: - types: [released, prereleased] - -env: - # TODO: Change variable to your image's name. - IMAGE_NAME: clusterio - -jobs: - # Build dependencies and clusterio image - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Build docker image - run: DOCKER_BUILDKIT=1 docker build . -t $IMAGE_NAME --target clusterio_final - - - name: Export docker image - run: docker save -o clusterio_docker_image $IMAGE_NAME - - - name: Upload docker image - uses: actions/upload-artifact@master - with: - name: clusterio_docker_image - path: clusterio_docker_image - # Build dependencies and clusterio image with test tooling - build_testing: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Build docker image - run: DOCKER_BUILDKIT=1 docker build . -t $IMAGE_NAME --target clusterio_testing - - - name: Export docker image - run: docker save -o clusterio_docker_image_testing $IMAGE_NAME - - - name: Upload docker image - uses: actions/upload-artifact@master - with: - name: clusterio_docker_image_testing - path: clusterio_docker_image_testing - # Upload clusterio_lib and subspace_storage versions - upload_mods: - needs: build - runs-on: ubuntu-latest - steps: - - name: Download docker image - uses: actions/download-artifact@master - with: - name: clusterio_docker_image - path: . - - - name: Load docker image - run: docker load -i clusterio_docker_image - - - name: Create container - run: docker create --name clusterio_container $IMAGE_NAME - - - name: Move mods out of container - run: docker cp clusterio_container:/clusterio/sharedMods ./mods - - - name: Remove container - run: docker rm clusterio_container - - - name: List extracted mods - run: ls mods - - - name: Upload mods - uses: actions/upload-artifact@master - with: - name: mods - path: mods - # Run tests. - # See also https://docs.docker.com/docker-hub/builds/automated-testing/ - test: - needs: build_testing - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Download docker image - uses: actions/download-artifact@master - with: - name: clusterio_docker_image_testing - path: . - - name: ls - run: ls && ls clusterio_docker_image_testing && ls /home/runner/work/clusterio && ls /home/runner/work/clusterio/clusterio - - name: Load docker image - run: docker load -i clusterio_docker_image_testing - - - name: Run tests - run: | - if [ -f docker-compose.test.yml ]; then - docker-compose --file docker-compose.test.yml run unit_test - else - docker build . --file Dockerfile - fi - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - # Ensure test job passes before pushing image. - needs: [test, build] - - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - uses: actions/checkout@v2 - - - name: Download artifact - uses: actions/download-artifact@master - with: - name: clusterio_docker_image - path: . - - - name: Load docker image - run: docker load -i clusterio_docker_image - - - name: Log into registry - run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=ghcr.io/${{ github.actor }}/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - - # Use Docker `latest` tag convention - [ "$VERSION" == "master" ] && VERSION=latest - - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker tag $IMAGE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION From e72ee3ecaffae13fea4f1c746611185f5ee3c837 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 19 Nov 2021 17:53:36 +0100 Subject: [PATCH 3/3] Added linter to CI action --- .github/workflows/node.js.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 99e76018..15abaaaa 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -8,10 +8,8 @@ on: pull_request: jobs: - build: - + test: runs-on: ubuntu-latest - strategy: matrix: node-version: [12.x, 14.x, 16.x] @@ -28,3 +26,14 @@ jobs: - run: npx lerna bootstrap --hoist - run: npx lerna run build - run: npm test + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16.x + - run: npm i --no-optional + - run: npx lerna bootstrap --hoist + - run: npm run lint