azure pipelines -> github actions

This commit is contained in:
Anthony Sottile 2022-12-29 20:54:03 -05:00
parent 848a73ed40
commit 887c5e1142
8 changed files with 69 additions and 79 deletions

41
.github/actions/pre-test/action.yml vendored Normal file
View file

@ -0,0 +1,41 @@
inputs:
env:
default: ${{ matrix.env }}
runs:
using: composite
steps:
- name: setup (windows)
shell: bash
if: runner.os == 'Windows'
run: |
set -x
echo 'TEMP=C:\TEMP' >> "$GITHUB_ENV"
echo "$CONDA\Scripts" >> "$GITHUB_PATH"
echo 'C:\Strawberry\perl\bin' >> "$GITHUB_PATH"
echo 'C:\Strawberry\perl\site\bin' >> "$GITHUB_PATH"
echo 'C:\Strawberry\c\bin' >> "$GITHUB_PATH"
testing/get-dart.sh
pwsh testing/get-r.ps1
- name: setup (linux)
shell: bash
if: runner.os == 'Linux'
run: |
set -x
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
lua5.3 \
liblua5.3-dev \
luarocks \
r-base
testing/get-coursier.sh
testing/get-dart.sh
testing/get-swift.sh
- uses: asottile/workflows/.github/actions/latest-git@v1.2.0
if: inputs.env == 'py38' && runner.os == 'Linux'

23
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: main
on:
push:
branches: [main, test-me-*]
tags:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
main-windows:
uses: asottile/workflows/.github/workflows/tox.yml@v1.2.0
with:
env: '["py38"]'
os: windows-latest
main-linux:
uses: asottile/workflows/.github/workflows/tox.yml@v1.2.0
with:
env: '["py38", "py39", "py310"]'
os: ubuntu-latest

View file

@ -1,5 +1,4 @@
[![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/pre-commit.pre-commit?branchName=main)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=main)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/21/main.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=21&branchName=main)
[![build status](https://github.com/pre-commit/pre-commit/actions/workflows/main.yml/badge.svg)](https://github.com/pre-commit/pre-commit/actions/workflows/main.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pre-commit/pre-commit/main.svg)](https://results.pre-commit.ci/latest/github/pre-commit/pre-commit/main)
## pre-commit

View file

@ -1,68 +0,0 @@
trigger:
branches:
include: [main, test-me-*]
tags:
include: ['*']
resources:
repositories:
- repository: asottile
type: github
endpoint: github
name: asottile/azure-pipeline-templates
ref: refs/tags/v2.4.1
jobs:
- template: job--python-tox.yml@asottile
parameters:
toxenvs: [py38]
os: windows
additional_variables:
TEMP: C:\Temp
pre_test:
- task: UseRubyVersion@0
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH
- powershell: |
Write-Host "##vso[task.prependpath]C:\Strawberry\perl\bin"
Write-Host "##vso[task.prependpath]C:\Strawberry\perl\site\bin"
Write-Host "##vso[task.prependpath]C:\Strawberry\c\bin"
displayName: Add strawberry perl to PATH
- bash: testing/get-dart.sh
displayName: install dart
- powershell: testing/get-r.ps1
displayName: install R
- template: job--python-tox.yml@asottile
parameters:
toxenvs: [py38]
os: linux
name_postfix: _latest_git
pre_test:
- task: UseRubyVersion@0
- template: step--git-install.yml
- bash: testing/get-coursier.sh
displayName: install coursier
- bash: testing/get-dart.sh
displayName: install dart
- bash: testing/get-lua.sh
displayName: install lua
- bash: testing/get-swift.sh
displayName: install swift
- bash: testing/get-r.sh
displayName: install R
- template: job--python-tox.yml@asottile
parameters:
toxenvs: [py38, py39, py310]
os: linux
pre_test:
- task: UseRubyVersion@0
- bash: testing/get-coursier.sh
displayName: install coursier
- bash: testing/get-dart.sh
displayName: install dart
- bash: testing/get-lua.sh
displayName: install lua
- bash: testing/get-swift.sh
displayName: install swift
- bash: testing/get-r.sh
displayName: install R

View file

@ -12,4 +12,4 @@ curl --location --silent --output "$ARTIFACT" "$COURSIER_URL"
echo "$COURSIER_HASH $ARTIFACT" | sha256sum --check
chmod ugo+x /tmp/coursier/cs
echo '##vso[task.prependpath]/tmp/coursier'
echo '/tmp/coursier' >> "$GITHUB_PATH"

View file

@ -5,10 +5,10 @@ VERSION=2.13.4
if [ "$OSTYPE" = msys ]; then
URL="https://storage.googleapis.com/dart-archive/channels/stable/release/${VERSION}/sdk/dartsdk-windows-x64-release.zip"
echo "##vso[task.prependpath]$(cygpath -w /tmp/dart-sdk/bin)"
cygpath -w /tmp/dart-sdk/bin >> "$GITHUB_PATH"
else
URL="https://storage.googleapis.com/dart-archive/channels/stable/release/${VERSION}/sdk/dartsdk-linux-x64-release.zip"
echo '##vso[task.prependpath]/tmp/dart-sdk/bin'
echo '/tmp/dart-sdk/bin' >> "$GITHUB_PATH"
fi
curl --silent --location --output /tmp/dart.zip "$URL"

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# Install the runtime and package manager.
sudo apt install lua5.3 liblua5.3-dev luarocks

View file

@ -26,4 +26,4 @@ fi
mkdir -p /tmp/swift
tar -xf "$TGZ" --strip 1 --directory /tmp/swift
echo '##vso[task.prependpath]/tmp/swift/usr/bin'
echo '/tmp/swift/usr/bin' >> "$GITHUB_PATH"