Switch over to B2 for CICD

This commit is contained in:
Wilson Lin 2020-06-19 09:49:48 +10:00
parent 2591f2879d
commit 8fa2e9c152
5 changed files with 77 additions and 57 deletions

View File

@ -36,10 +36,11 @@ jobs:
- name: Run bench and graph results - name: Run bench and graph results
working-directory: ./bench working-directory: ./bench
run: ./bench.sh run: ./bench.sh
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI
- name: Upload to S3 run: |
env: pip install setuptools
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} pip install --upgrade b2
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Upload to B2
AWS_REGION: us-west-2 run: |
run: aws s3 cp ./bench/results/ s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bench/${{ steps.version.outputs.VERSION }}/ --recursive b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 sync ./bench/results/ b2://${{ secrets.CICD_CLI_B2_BUCKET_NAME }}/hyperbuild/bench/${{ steps.version.outputs.VERSION }}/

View File

@ -41,11 +41,18 @@ jobs:
profile: minimal profile: minimal
default: true default: true
- name: Build CLI - name: Build CLI
working-directory: ./cli
run: cargo build --release run: cargo build --release
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI (macOS, Linux)
- name: Upload to S3 if: runner.os != 'Windows'
env: run: |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} sudo pip install setuptools
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} sudo pip install --upgrade b2
AWS_REGION: us-west-2 - name: Install B2 CLI (Windows)
run: aws s3 cp ./target/release/hyperbuild${{ matrix.EXT }} s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/${{ steps.file.outputs.FILE }} --content-type ${{ matrix.MIME }} if: runner.os == 'Windows'
run: |
pip install --upgrade b2
- name: Upload to B2
run: |
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./cli/target/release/hyperbuild${{ matrix.EXT }} hyperbuild/bin/${{ steps.file.outputs.FILE }}

View File

@ -12,7 +12,7 @@ jobs:
matrix: matrix:
# Use windows-2016 as windows-2019 has LNK1181 error when building Neon module. # Use windows-2016 as windows-2019 has LNK1181 error when building Neon module.
os: [ubuntu-latest, windows-2016, macos-latest] os: [ubuntu-latest, windows-2016, macos-latest]
node: [8, 9, 10, 11, 12, 13] node: [8, 9, 10, 11, 12, 13, 14]
include: include:
- os: ubuntu-latest - os: ubuntu-latest
ARCH: linux-x86_64 ARCH: linux-x86_64
@ -41,13 +41,19 @@ jobs:
run: | run: |
npm install npm install
node node_modules/neon-cli/bin/cli.js build --release node node_modules/neon-cli/bin/cli.js build --release
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI (macOS, Linux)
- name: Upload to S3 if: runner.os != 'Windows'
env: run: |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} sudo pip install setuptools
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} sudo pip install --upgrade b2
AWS_REGION: us-west-2 - name: Install B2 CLI (Windows)
run: aws s3 cp ./nodejs/native/index.node s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/${{ matrix.ARCH }}-node${{ matrix.node }}.node if: runner.os == 'Windows'
run: |
pip install --upgrade b2
- name: Upload to B2
run: |
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./nodejs/native/index.node hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/${{ matrix.ARCH }}-node${{ matrix.node }}.node
package: package:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
@ -60,14 +66,11 @@ jobs:
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@master uses: actions/setup-node@master
with: with:
node-version: 13.x node-version: 14.x
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI
run: pip install --upgrade b2
- name: Pack and publish package - name: Pack and publish package
working-directory: ./nodejs working-directory: ./nodejs
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
run: | run: |
cat << 'EOF' > .npmrc cat << 'EOF' > .npmrc
package-lock=false package-lock=false
@ -76,6 +79,7 @@ jobs:
npm install npm install
rm -rf dist rm -rf dist
node node_modules/typescript/bin/tsc node node_modules/typescript/bin/tsc
aws s3 mv s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/ ./dist/. --recursive b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 sync b2://${{ secrets.CICD_CLI_B2_BUCKET_NAME }}/hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/ ./dist/.
cp ../README.md . cp ../README.md .
npm publish npm publish

View File

@ -52,14 +52,20 @@ jobs:
- name: Build native module - name: Build native module
working-directory: ./python working-directory: ./python
run: cargo build --release run: cargo build --release
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI (macOS, Linux)
- name: Upload to S3 if: runner.os != 'Windows'
env: run: |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} sudo pip install setuptools
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} sudo pip install --upgrade b2
AWS_REGION: us-west-2 - name: Install B2 CLI (Windows)
if: runner.os == 'Windows'
run: |
pip install --upgrade b2
- name: Upload to B2
# Convert dots to underscores in Python version as Python uses dots to represent import hierarchy. # Convert dots to underscores in Python version as Python uses dots to represent import hierarchy.
run: aws s3 cp ./python/target/release/${{ matrix.LIBFILE }} s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/python/${{ steps.version.outputs.VERSION }}/${{ steps.native_file.outputs.NAME }} run: |
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./python/target/release/${{ matrix.LIBFILE }} hyperbuild/bin/python/${{ steps.version.outputs.VERSION }}/${{ steps.native_file.outputs.NAME }}
package: package:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
@ -75,19 +81,14 @@ jobs:
python-version: '3.5' python-version: '3.5'
architecture: 'x64' architecture: 'x64'
- name: Install Python dependencies - name: Install Python dependencies
# chrislennon/action-aws-cli@v1.1 interferes with installed Python libraries.
# Installing using pip seems to be more reliable when done individually.
run: | run: |
pip install --upgrade awscli
pip install --upgrade wheel pip install --upgrade wheel
pip install --upgrade setuptools pip install --upgrade setuptools
pip install --upgrade twine pip install --upgrade twine
- name: Install B2 CLI
run: pip install --upgrade b2
- name: Pack and publish package - name: Pack and publish package
working-directory: ./python working-directory: ./python
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
run: | run: |
cat << 'EOF' > "$HOME/.pypirc" cat << 'EOF' > "$HOME/.pypirc"
[pypi] [pypi]
@ -95,6 +96,7 @@ jobs:
password = ${{ secrets.PYPI_API_TOKEN }} password = ${{ secrets.PYPI_API_TOKEN }}
EOF EOF
cp ../README.md . cp ../README.md .
aws s3 mv s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/python/${{ steps.version.outputs.VERSION }}/ ./hyperbuild/. --recursive b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 sync b2://${{ secrets.CICD_CLI_B2_BUCKET_NAME }}/hyperbuild/bin/python/${{ steps.version.outputs.VERSION }}/ ./hyperbuild/.
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
python -m twine upload dist/* python -m twine upload dist/*

View File

@ -67,13 +67,19 @@ jobs:
shell: bash -l {0} shell: bash -l {0}
run: cargo build --release run: cargo build --release
working-directory: ./ruby working-directory: ./ruby
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI (macOS, Linux)
- name: Upload to S3 if: runner.os != 'Windows'
env: run: |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} sudo pip install setuptools
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} sudo pip install --upgrade b2
AWS_REGION: us-west-2 - name: Install B2 CLI (Windows)
run: aws s3 cp ./ruby/target/release/${{ matrix.FILE }} s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/ruby/${{ steps.version.outputs.VERSION }}/${{ steps.native_file.outputs.NAME }} if: runner.os == 'Windows'
run: |
pip install --upgrade b2
- name: Upload to B2
run: |
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 upload-file --contentType ${{ matrix.MIME }} ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./ruby/target/release/${{ matrix.FILE }} hyperbuild/bin/ruby/${{ steps.version.outputs.VERSION }}/${{ steps.native_file.outputs.NAME }}
package: package:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
@ -87,16 +93,16 @@ jobs:
uses: actions/setup-ruby@v1 uses: actions/setup-ruby@v1
with: with:
ruby-version: '2.5' ruby-version: '2.5'
- uses: chrislennon/action-aws-cli@v1.1 - name: Install B2 CLI
run: |
pip install setuptools
pip install --upgrade b2
- name: Pack and publish gem - name: Pack and publish gem
working-directory: ./ruby working-directory: ./ruby
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
run: | run: |
cp ../README.md . cp ../README.md .
aws s3 mv s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/ruby/${{ steps.version.outputs.VERSION }}/ ./lib/. --recursive b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 sync b2://${{ secrets.CICD_CLI_B2_BUCKET_NAME }}/hyperbuild/bin/ruby/${{ steps.version.outputs.VERSION }}/ ./lib/.
gem build hyperbuild.gemspec gem build hyperbuild.gemspec
mkdir -p "$HOME/.gem" mkdir -p "$HOME/.gem"
cat << 'EOF' > "$HOME/.gem/credentials" cat << 'EOF' > "$HOME/.gem/credentials"