From bd3562d9a3be79dc012d47242b1d7f328a6ea255 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 18 Dec 2020 10:05:04 -0500 Subject: [PATCH 1/2] Switch from Travis CI to GitHub Action `build.yml` --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ .travis.yml | 9 --------- README.md | 4 ++-- scripts/txpush.sh | 21 --------------------- 4 files changed, 30 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml delete mode 100755 scripts/txpush.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..13b82ea25 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +# This workflow will do a clean install of node dependencies, 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: build + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run all + - run: npm run test \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7b3e4d015..000000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - "10" - - "12" - - "14" -before_script: - - npm run all -after_success: - - ./scripts/txpush.sh diff --git a/README.md b/README.md index 5d28aa7c0..6b3569fde 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # iD - friendly JavaScript editor for [OpenStreetMap](https://www.openstreetmap.org/) -[![Build Status](https://travis-ci.org/openstreetmap/iD.svg?branch=develop)](https://travis-ci.org/openstreetmap/iD) +[![build](https://github.com/openstreetmap/iD/workflows/build/badge.svg)](https://github.com/openstreetmap/iD/actions?query=workflow%3A%22build%22) ## Basics @@ -97,4 +97,4 @@ iD also bundles portions of the following open source software. ## Thank you -Initial development of iD was made possible by a [grant of the Knight Foundation](https://www.mapbox.com/blog/knight-invests-openstreetmap/). +Initial development of iD was made possible by a [grant of the Knight Foundation](https://www.mapbox.com/blog/knight-invests-openstreetmap/). \ No newline at end of file diff --git a/scripts/txpush.sh b/scripts/txpush.sh deleted file mode 100755 index e2a83de5e..000000000 --- a/scripts/txpush.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# This script runs on TravisCI to push new translation strings to transifex - -echo "TRAVIS=$TRAVIS" -echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" -echo "TRAVIS_BRANCH=$TRAVIS_BRANCH" -echo "TRAVIS_NODE_VERSION=$TRAVIS_NODE_VERSION" - -if [[ "$TRAVIS" != "true" ]]; then exit 0; fi -if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi -if [[ "$TRAVIS_BRANCH" != "develop" ]]; then exit 0; fi -if [[ "$TRAVIS_NODE_VERSION" != "10" ]]; then exit 0; fi - -echo "Pushing source strings to Transifex..." -pip install virtualenv -virtualenv ~/env -source ~/env/bin/activate -pip install transifex-client -sudo echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = '"$TRANSIFEX_USER"$'\npassword = '"$TRANSIFEX_PASSWORD"$'\n' > ~/.transifexrc -tx push -s From f3d6b3aebaec63e4c0f123d0f6a6b5e161308de8 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 18 Dec 2020 10:07:47 -0500 Subject: [PATCH 2/2] Add GitHub Action to push source translation strings to Transifex - requires TX_TOKEN secret to be set on GitHub - you can generate a token at https://www.transifex.com/user/settings/api/ - `tx push` should fail silently if this is not provided --- .github/workflows/transifex.yml | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/transifex.yml diff --git a/.github/workflows/transifex.yml b/.github/workflows/transifex.yml new file mode 100644 index 000000000..376bd73cd --- /dev/null +++ b/.github/workflows/transifex.yml @@ -0,0 +1,39 @@ +# This workflow will push the iD source strings to transifex +# - requires TX_TOKEN secret to be set on GitHub +# - you can generate a token at https://www.transifex.com/user/settings/api/ +# - job should fail silently if no token provided + +name: transifex + +on: + push: + branches: + - develop + +jobs: + transifex: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install transifex-client + - name: Create .transifexrc + uses: DamianReeves/write-file-action + with: + path: ${{env.home}}/.transifexrc + write-mode: overwrite + contents: | + [https://www.transifex.com] + api_hostname = https://api.transifex.com + hostname = https://www.transifex.com + password = ${{secrets.TX_TOKEN}} + username = api + - name: Push source strings to Transifex + run: tx push --source --no-interactive \ No newline at end of file