diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 000000000..1e9fe1ea1 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,39 @@ +name: Build SDK Files & S3 Upload + +on: + workflow_dispatch: + +jobs: + test_build_deploy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: "[Setup] Install dependencies" + run: yarn + - name: "[Test] Run all tests" + run: yarn test:CI + - name: "[Build] Staging" + env: + STAGING_DOMAIN: ${{ secrets.STAGING_DOMAIN }} + run: BUILD_ORIGIN=${STAGING_DOMAIN} API=staging API_ORIGIN=${STAGING_DOMAIN} yarn build:staging + - name: "[Build] Production" + run: yarn build:prod + - name: "[Deploy] Upload SDK Files to S3" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: ./build/scripts/s3-simple-upload-all.sh build/releases s3://onesignal-build/websdk/${{ github.sha }} + - name: "[Deploy] Upload AMP SDK Files to S3" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: ./build/scripts/s3-simple-upload-all.sh build/amp s3://onesignal-build/websdk/${{ github.sha }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..d3dfef9d7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Run Tests +on: + pull_request: + branches: + - "**" + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: "[Setup] Install dependencies" + run: yarn + - name: "[Test] Run all tests" + run: yarn test:CI diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 46178846f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Travis CI Configuration File -# -# Setting up w/ NodeJS: https://docs.travis-ci.com/user/languages/javascript-with-nodejs/ - -language: node_js -node_js: - - '12.18.0' -cache: - yarn: true - directories: - - node_modules -script: - - yarn test:CI - - yarn build:prod - - BUILD_ORIGIN=${STAGING_DOMAIN} API=staging API_ORIGIN=${STAGING_DOMAIN} yarn build:staging - # thanks to https://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/ - - BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - - if [[ "$BRANCH" == "main" || "$BRANCH" == "staging" ]]; then ./.travis/s3-simple-upload-all.sh build/releases s3://onesignal-build/websdk/$TRAVIS_COMMIT && ./.travis/s3-simple-upload-all.sh build/amp s3://onesignal-build/websdk/$TRAVIS_COMMIT && echo Successfully uploaded Web SDK artifacts for version $TRAVIS_COMMIT; else echo Not uploading artifacts for this build; fi -git: - depth: 5 -env: - - CXX=g++-4.8 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 diff --git a/README.md b/README.md index 1047169c9..ec852fb9a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[](https://travis-ci.org/OneSignal/OneSignal-Website-SDK) -
diff --git a/.travis/s3-simple-upload-all.sh b/build/scripts/s3-simple-upload-all.sh
similarity index 100%
rename from .travis/s3-simple-upload-all.sh
rename to build/scripts/s3-simple-upload-all.sh
diff --git a/.travis/s3-simple.sh b/build/scripts/s3-simple.sh
similarity index 100%
rename from .travis/s3-simple.sh
rename to build/scripts/s3-simple.sh
diff --git a/test/README.md b/test/README.md
index 5fd84d71d..499f68bf3 100644
--- a/test/README.md
+++ b/test/README.md
@@ -10,7 +10,7 @@ Tests are built to run with the [AVA test runner](https://github.com/avajs/ava)
### Option 1 - Run locally
> Recommend for macOS or if you haven't used or setup docker before.
-1. Install the specific version of Node.js defined in `.travis.yml` in this repo.
+1. Install the specific version of Node.js defined in the Github Actions `ci.yml` in this repo.
### Option 2 - Run with Docker
> NOT Recommend for macOS due to performance issues, about 10x slower.