Skip to content

Bump actions/setup-node from 3.8.0 to 4.0.0 #17

Bump actions/setup-node from 3.8.0 to 4.0.0

Bump actions/setup-node from 3.8.0 to 4.0.0 #17

Workflow file for this run

name: Test
on:
pull_request_target:
types: [labeled]
push:
branches-ignore:
- "dependabot/**"
repository_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event_name == 'push' || github.event_name == 'repository_dispatch'
env:
TRANSLATION_S3_PATH: s3://github-bridge-actions/sources/bridge-actions/en/en.json
AWS_ACCESS_KEY_ID: access_key
AWS_SECRET_ACCESS_KEY: sekret42
AWS_EC2_METADATA_DISABLED: true
steps:
# NOTE: this is ordered first so minio has time to start up and become healthy
- name: Start MinIO
run: |
docker run \
--name=minio \
--detach \
-p 9000:9000 \
-e MINIO_ACCESS_KEY=${{ env.AWS_ACCESS_KEY_ID }} \
-e MINIO_SECRET_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
--health-interval=2s \
--health-cmd="curl --fail http://localhost:9000/minio/health/ready || exit 1" \
minio/minio \
server /data
- uses: actions/[email protected]
with:
persist-credentials: false
- uses: actions/[email protected]
with:
node-version: 14
scope: '@get-bridge'
registry-url: https://npm.pkg.github.com
- name: Wait for MinIO to be healthy
run: |
set -o xtrace
healthcheck () {
docker inspect --format='{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}' minio;
}
until [ "$(healthcheck)" = "healthy" ]; do sleep 2; done
- name: Create bucket 'github-bridge-actions'
run: |
# make the bucket match what's in config.json
aws --endpoint-url=http://localhost:9000 s3 mb s3://github-bridge-actions --region us-east-2
- name: Populate bucket with test fixture
run: aws --endpoint-url=http://localhost:9000 s3 cp test/fixtures/translations.json ${TRANSLATION_S3_PATH}
- name: Simulate adding a new translation message to en.json
run: |
cat test/fixtures/translations.json | \
jq '. + { "a_third_translation_key": { "message": "A third translation key" } }' \
> test/fixtures/en.json
- uses: ./
env:
NODE_AUTH_TOKEN: ${{ secrets.GIT_HUB_PACKAGES_TOKEN }}
with:
config: test/fixtures/config.json
- name: Assert S3 was updated and matches local en.json
env:
EXPECTED_JSON: '{"a_first_translation_key": {"message": "A first translation key"}, "a_second_translation_key": {"message": "A second translation key"}, "a_third_translation_key": {"message": "A third translation key"}}'
run: |
set -exu
translation_json=$(
aws --endpoint-url=http://localhost:9000 \
s3 cp ${TRANSLATION_S3_PATH} - \
| jq --compact-output . \
| jq --raw-input . \
)
expected_json=$(echo ${EXPECTED_JSON} | jq --compact-output . | jq --raw-input .)
test "$translation_json" = "$expected_json"