Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: implement build and release automation #34

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6620fcf
chore: implement build and release automation
dbjorge Aug 24, 2022
f4bfd15
chore: disable dotnet format step for a separate PR to handle
dbjorge Aug 24, 2022
06ae777
chore: fix trigger syntax for pr checks workflow
dbjorge Aug 24, 2022
c7fc2c2
chore: fix broken filename in publish-nuget-packages step
dbjorge Aug 24, 2022
ed0833b
chore: fix alias listed in pr-reviewers
dbjorge Aug 24, 2022
0fd18e0
chore: update github release step to pass required env vars
dbjorge Aug 24, 2022
04a7ea5
chore: remove related obsolete files from selenium package
dbjorge Aug 24, 2022
c27872a
chore: fix path syntax for reusable workflow refs
dbjorge Aug 24, 2022
5e2996d
chore: temporarily trigger PR build on push to draft branch for testing
dbjorge Aug 24, 2022
8783235
chore: fix unsupported choice type for workflow_call input
dbjorge Aug 24, 2022
2b72372
chore: fix packages artifact creation
dbjorge Aug 24, 2022
49803fa
chore: validate assumption that the build must run on windows
dbjorge Aug 24, 2022
0a5fc20
chore: skip choco upgrade step for linux testing
dbjorge Aug 24, 2022
10fb440
chore: commit build-and-test to ubuntu-latest
dbjorge Aug 24, 2022
3028ebb
chore: make selenium tests use agent-provided webdrivers if available
dbjorge Aug 24, 2022
1a8a7dc
chore: fix selenium test logic for using actions agent webdriver env …
dbjorge Aug 24, 2022
429d3aa
chore: switch to headless browsers
dbjorge Aug 24, 2022
ece616d
chore: attempt to fix linux-specific selenium integration test issues
dbjorge Aug 24, 2022
554f498
chore: suppress publishing jobs in forks
dbjorge Aug 24, 2022
1401f89
chore: remove test trigger from pr build
dbjorge Aug 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/scripts/prepare_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Fail on first error.
set -e

releaseLevel="$1"

oldVersion="$(node -pe 'require("./package.json").version')"
npx commit-and-tag-version@"$COMMIT_AND_TAG_VERSION_VERSION" --release-as "$releaseLevel" --skip.commit=true --skip.changelog=true --skip.tag=true
newVersion="$(node -pe 'require("./package.json").version')"

sed -i -e "s/<VersionPrefix>$oldVersion<\/VersionPrefix>/<VersionPrefix>$newVersion<\/VersionPrefix>/" ./packages/*/src/*.csproj

npx conventional-changelog-cli@"$CHANGELOG_VERSION" -p angular -i CHANGELOG.md -s
18 changes: 18 additions & 0 deletions .github/workflows/auto-assign-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto assign axe-core integration issues to Axe API team project board

on:
issues:
types: [opened]
env:
MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

jobs:
assign_one_project:
runs-on: ubuntu-latest
name: Auto assign axe-core integration issues to Axe API team project board
steps:
- name: Auto assign axe-core integration issues to Axe API team project board
uses: srggrs/assign-one-project-github-action@1.2.1
with:
project: https://github.com/orgs/dequelabs/projects/53
column_name: 'Ungroomed'
63 changes: 63 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and test

on:
# This is a reusable workflow, not intended to be invoked directly
workflow_call:
inputs:
configuration:
description: "debug or release (for use with dotnet CLI's -c argument)"
required: true
type: string
version-suffix:
description: "Version suffix (eg, for a version of 1.2.3-alpha.1, pass, \"-alpha.1\")"
required: true
type: string

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Install .NET Core 3.1 and 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.x.x

- name: Install NuGet dependencies
run: dotnet restore

# Enabling this alongside changes to make the existing code consistent is tracked by #33
# - name: Check formatting
# run: dotnet format --verify-no-changes

- name: Build
run: dotnet build --no-restore -c ${{ inputs.configuration }} -p:VersionSuffix=${{ inputs.version-suffix }}

- name: Test
run: dotnet test --no-build -c ${{ inputs.configuration }} -p:VersionSuffix=${{ inputs.version-suffix }}

- uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
name: Upload test-results artifact
with:
name: test-results
path: |
${{ github.workspace }}/packages/*/test/TestResults

- name: Prepare packages artifact
run: |
mkdir ${{ github.workspace }}/packages-artifact
cp ${{ github.workspace }}/packages/*/src/bin/*/*.nupkg ${{ github.workspace }}/packages-artifact
cp ${{ github.workspace }}/packages/*/src/bin/*/*.snupkg ${{ github.workspace }}/packages-artifact

- uses: actions/upload-artifact@v2
name: Upload packages artifact
with:
name: packages
path: ${{ github.workspace }}/packages-artifact

59 changes: 59 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create release candidate

on:
workflow_dispatch:
inputs:
releaseLevel:
description: 'Release level: major, minor, or patch.'
required: true
default: 'patch'

jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Run preparation script
run: bash .github/scripts/prepare_release.sh ${{ github.event.inputs.releaseLevel }}
env:
CHANGELOG_VERSION: ${{ secrets.CHANGELOG_VERSION }}
COMMIT_AND_TAG_VERSION_VERSION: ${{ secrets.COMMIT_AND_TAG_VERSION_VERSION }}

- name: Get version for later steps
id: get-new-version
run: echo ::set-output name=version::$(node -pe 'require("./package.json").version')

- name: Create release commit
run: |
git config user.name "${{ secrets.ADT_API_RELEASE_NAME}}"
git config user.email "${{ secrets.ADT_API_RELEASE_EMAIL }}"
git commit -am "chore: release v${{ steps.get-new-version.outputs.version }}"

# create-pull-request has no way of setting the target branch that won't also
# get rid of all commits (aside from the release commit).
# So, we have to be on master and manually grab all the changes.
# We do that by just telling git "master is now develop (+ the release commit)".
- name: Update local master from develop
run: |
commitHash="$(git log -1 --format='%H')"
git checkout master
git reset --hard "$commitHash"

- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release
branch-suffix: timestamp
base: master
title: "chore: release v${{ steps.get-new-version.outputs.version }}"
# If there are any changes not already committed, they will be added to
# a commit with this as the message.
# If there are no changes no commit will be created.
commit-message: "chore: applying release changes"
21 changes: 21 additions & 0 deletions .github/workflows/publish-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish canary

on:
push:
branches:
- develop

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
with:
configuration: release
version-suffix: "-alpha.${{ github.run_number }}"

publish-nuget:
if: github.repository_owner == 'dequelabs' # don't attempt to publish from forks
environment: nuget-canary
needs: ["build-and-test"]
uses: ./.github/workflows/publish-nuget-packages.yml
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
38 changes: 38 additions & 0 deletions .github/workflows/publish-nuget-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish NuGet packages

on:
# This is a reusable workflow, not intended to be invoked directly
workflow_call:
inputs:
packages-artifact-name:
description: "Name of a previously-uploaded artifact containing a flat collection of .nupkgs to publish"
default: packages # matches what ./build-and-test.yml produces
type: string
secrets:
NUGET_API_KEY:
required: true

jobs:
publish-nuget-packages:
runs-on: ubuntu-latest
steps:
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.x.x

- name: Download packages artifact from build-and-test job
uses: actions/download-artifact@v2
with:
name: ${{ inputs.packages-artifact-name }}
path: ${{ github.workspace }}/packages

# Order is important - if publishing Commons fails, we want the job to abort without attempting the others
- name: Publish Deque.AxeCore.Commons to NuGet
run: dotnet nuget push packages/Deque.AxeCore.Commons.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Publish Deque.AxeCore.Selenium to NuGet
run: dotnet nuget push packages/Deque.AxeCore.Selenium.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Publish Deque.AxeCore.Playwright to NuGet
run: dotnet nuget push packages/Deque.AxeCore.Playwright.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
42 changes: 42 additions & 0 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish production

on:
push:
branches:
- master

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
with:
configuration: release
version-suffix: ""

publish-nuget:
if: github.repository_owner == 'dequelabs' # don't attempt to publish from forks
environment: nuget-production
needs: ["build-and-test"]
uses: ./.github/workflows/publish-nuget-packages.yml
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

publish-github-release:
if: github.repository_owner == 'dequelabs' # don't attempt to publish from forks
environment: github-releases
needs: ["publish-nuget"]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- run: go get gopkg.in/aktau/github-release.v0

- name: Download and run GitHub release script
run: |
curl https://raw.githubusercontent.com/dequelabs/attest-release-scripts/develop/src/node-github-release.sh -s -o ./node-github-release.sh
chmod +x ./node-github-release.sh
./node-github-release.sh
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PUBLISHING_GITHUB_TOKEN }}
CIRCLE_PROJECT_USERNAME: ${{ github.repository_owner }}
CIRCLE_PROJECT_REPONAME: ${{ github.event.repository.name }}
11 changes: 11 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: PR checks

on:
pull_request:

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
with:
configuration: debug
version-suffix: "-development.${{ github.sha }}"
17 changes: 17 additions & 0 deletions .github/workflows/sync-master-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Sync master/develop branches
on:
pull_request:
types: [closed]
branches: master
jobs:
create_sync_pull_request:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == 'true'
steps:
- uses: dequelabs/action-sync-branches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-title: "chore: merge master into develop"
pr-reviewers: AdnoC,michael-siek
pr-labels: chore
pr-template: .github/PULL_REQUEST_TEMPLATE.md
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "axe-core-nuget",
"description": "this file is used by release workflows as the source of truth for the current version of all NuGet packages",
"version": "4.4.0",
"license": "MPL-2.0 AND MIT",
"repository": "dequelabs/axe-core-nuget",
"private": true
}
4 changes: 2 additions & 2 deletions packages/commons/src/Deque.AxeCore.Commons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<!-- override this in official/release build/pack/publish commands with -p:Version=x.y.z -->
<VersionPrefix>0.0.0</VersionPrefix>
<!-- Do not update this by-hand; updates are automated via the create-release workflow -->
<VersionPrefix>4.4.0</VersionPrefix>
<VersionSuffix>development</VersionSuffix>
</PropertyGroup>

Expand Down
34 changes: 0 additions & 34 deletions packages/selenium/.github/release-drafter.yml

This file was deleted.

Loading