Use base URL of GitLab for the /uploads
URLs
#2317
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test & Deploy | |
on: | |
pull_request_target: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
release: | |
required: true | |
type: boolean | |
schedule: | |
- cron: '0 8 * * 1' # M H d m w (Mondays at 8:00) | |
jobs: | |
authorize: | |
environment: | |
${{ (github.event_name == 'pull_request_target' && | |
github.event.pull_request.head.repo.full_name != github.repository) && | |
'external' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo ✓ | |
check-lock: | |
needs: authorize | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- name: npm lock file is v2 | |
run: jq --exit-status .lockfileVersion==2 < package-lock.json | |
lint: | |
needs: authorize | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-node@v3 | |
- run: npm ci | |
- run: npm run lint | |
test: | |
needs: authorize | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- run: | | |
pip install tensorboard | |
pip install -I protobuf==3.20.1 | |
- run: npm ci && npm install --global | |
- run: npm run test | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | |
TEST_GITHUB_REPOSITORY: ${{ vars.TEST_GITHUB_REPOSITORY }} | |
TEST_GITHUB_COMMIT: ${{ vars.TEST_GITHUB_COMMIT }} | |
TEST_GITHUB_ISSUE: ${{ vars.TEST_GITHUB_ISSUE }} | |
TEST_GITLAB_TOKEN: ${{ secrets.TEST_GITLAB_TOKEN }} | |
TEST_GITLAB_REPOSITORY: ${{ vars.TEST_GITLAB_REPOSITORY }} | |
TEST_GITLAB_COMMIT: ${{ vars.TEST_GITLAB_COMMIT }} | |
TEST_GITLAB_ISSUE: ${{ vars.TEST_GITLAB_ISSUE }} | |
TEST_BITBUCKET_TOKEN: ${{ secrets.TEST_BITBUCKET_TOKEN }} | |
TEST_BITBUCKET_REPOSITORY: ${{ vars.TEST_BITBUCKET_REPOSITORY }} | |
TEST_BITBUCKET_COMMIT: ${{ vars.TEST_BITBUCKET_COMMIT }} | |
TEST_BITBUCKET_ISSUE: ${{ vars.TEST_BITBUCKET_ISSUE }} | |
test-os: | |
needs: authorize | |
name: test-${{ matrix.system }} | |
strategy: | |
matrix: | |
system: [ubuntu, macos, windows] | |
runs-on: ${{ matrix.system }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- if: matrix.system == 'windows' | |
uses: actions/setup-node@v3 | |
- name: install | |
shell: bash | |
run: | | |
# https://github.com/npm/npm/issues/18503#issuecomment-347579469 | |
npm pack && npm install -g --no-save ./*cml*.tgz | |
for cmd in '' runner publish pr; do | |
cml $cmd --version | |
done | |
- if: matrix.system != 'windows' | |
run: | | |
for cmd in runner publish pr; do | |
cml-$cmd --version | |
done | |
packages: | |
needs: [lint, test, test-os] | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.publish.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
registry-url: https://registry.npmjs.org | |
- run: npm install | |
- id: publish | |
run: | | |
VERSION=$(jq -r .version < package.json) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
npm install --dry-run @dvcorg/cml@$VERSION || | |
npm ${{ inputs.release && 'publish' || 'publish --dry-run' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Step required "thanks" to https://github.com/actions/runner-images/issues/6283 | |
- uses: Homebrew/actions/setup-homebrew@3040c87fbdd10e6ec48d90bd23cb0abb6d66152d | |
- run: brew install ldid | |
- run: | | |
cp node_modules/@npcz/magic/dist/magic.mgc assets/magic.mgc | |
npx --yes pkg --no-bytecode --public-packages "*" --public package.json | |
for cmd in '' runner publish pr; do build/cml-linux-x64 $cmd --version; done | |
cp build/cml-linux{-x64,} | |
cp build/cml-macos{-x64,} | |
- if: inputs.release | |
run: | |
find build -type f | xargs gh release upload | |
"${GITHUB_HEAD_REF#bump/}" | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
images: | |
needs: packages | |
secrets: inherit | |
uses: ./.github/workflows/images.yml | |
with: | |
release: ${{ inputs.release || false }} | |
version: ${{ needs.packages.outputs.version }} |