Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

more github actinos #1037

Merged
merged 4 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Linters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want clippy in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we currently do not check clippy in CI and have a number of warnings. this would fail right now so i think this is worth tackling separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it! do we have an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#373 sorta


on: [push]

jobs:
rustfmt:
name: Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Install Rust
run: |
rustup update stable
rustup default stable
rustup component add rustfmt

- name: Check Formatting
run: cargo fmt -- --check
212 changes: 212 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
on:
push:
tags:
- "v*" # Run when tag matches v*, i.e. v1.0, v20.15.10

name: Release

env:
RELEASE_BIN: wrangler
RELEASE_DIR: artifacts
GITHUB_REF: "${{ github.ref }}"
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_TARGET: x86_64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-musl

# Space separated paths to include in the archive.
RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT wrangler-demo.gif banner.png

jobs:
build:
name: Build artifacts
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, windows, wranglerjs]
include:
- build: linux
os: ubuntu-latest
rust: stable
- build: macos
os: macos-latest
rust: stable
- build: windows
os: windows-latest
rust: stable
- build: wranglerjs
os: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache Cargo registry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic is duplicated - is there anyway to pull it out into it's own thing and share it across the actions (not a blocker, just curious)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure! i wasn't able to find anything similar to azure pipelines templates but happy to use if it exists (perhaps @signalnerve knows?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can refactor, let's get this in and open an issue to investigate? could be a great way for @signalnerve to contribute to wrangler <3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh hey i'm sorry i missed this notification! sounds interesting, would be down to collab with @EverlastingBugstopper on this in the future if you're down 👍

uses: actions/cache@v1
if: matrix.rust
with:
path: ~/.cargo/registry
key: ${{ matrix.build }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-stable-cargo-registry-

- name: Cache Cargo index
uses: actions/cache@v1
if: matrix.rust
with:
path: ~/.cargo/git
key: ${{ matrix.build }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-stable-cargo-index-

- name: Cache Cargo build
uses: actions/cache@v1
if: matrix.rust
with:
path: target/release
key: ${{ matrix.build }}-stable-release-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-stable-release-target-

- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"

- name: Install Rust
if: matrix.rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}

- name: Install musl-tools (Linux)
if: matrix.build == 'linux'
run: |
sudo apt-get update -y
sudo apt-get install musl-tools -y

- name: Install p7zip (MacOS)
if: matrix.build == 'macos'
run: brew install p7zip

- name: Build (Linux)
if: matrix.build == 'linux'
run: |
rustup target add ${{ env.LINUX_TARGET }}
cargo build --release --target ${{ env.LINUX_TARGET }} --features vendored-openssl

- name: Build (MacOS)
if: matrix.build == 'macos'
run: cargo build --release

- name: Build (Windows)
if: matrix.build == 'windows'
run: cargo build --release
env:
RUSTFLAGS: -Ctarget-feature=+crt-static

- name: Create artifact directory
run: mkdir ${{ env.RELEASE_DIR }}

- name: Create tarball (Linux)
if: matrix.build == 'linux'
run: 7z a -ttar -so -an ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz

- name: Create tarball (Windows)
if: matrix.build == 'windows'
run: 7z a -tzip ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz ./target/release/${{ env.RELEASE_BIN }}.exe ${{ env.RELEASE_ADDS }}

- name: Create tarball (MacOS)
if: matrix.build == 'macos'
run: 7z a -tzip ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}

- name: Create tarball (wranglerjs)
if: matrix.build == 'wranglerjs'
run: 7z a -ttar -so -an ./wranglerjs | 7z a -si ./${{ env.RELEASE_DIR }}/wranglerjs-${{ steps.get_version.outputs.VERSION }}.tar.gz

- name: Upload Zip
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.build }}
path: ./${{ env.RELEASE_DIR }}

release:
name: Github Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}

- name: Download wranglerjs tarball
uses: actions/download-artifact@v1
with:
name: wranglerjs

- name: Download Linux tarball
uses: actions/download-artifact@v1
with:
name: linux

- name: Download MacOS tarball
uses: actions/download-artifact@v1
with:
name: windows

- name: Download MacOS tarball
uses: actions/download-artifact@v1
with:
name: macos

- name: Release wranglerjs tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./wranglerjs/wranglerjs-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip
asset_name: wranglerjs-${{ steps.get_version.outputs.VERSION }}.tar.gz

- name: Release Linux tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux/wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz

- name: Release Windows tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz

- name: Release MacOS tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos/wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz
asset_content_type: application/gzip
asset_name: wrangler-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz
78 changes: 0 additions & 78 deletions .github/workflows/rust.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Tests

on: [push]

jobs:
test:
name: Test

runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
[
linux-stable,
linux-nightly,
macos-stable,
macos-nightly,
windows-stable,
windows-nightly,
]
include:
- build: linux-stable
os: ubuntu-latest
rust: stable
- build: macos-stable
os: macos-latest
rust: stable
- build: windows-stable
os: windows-latest
rust: stable
- build: linux-nightly
os: ubuntu-latest
rust: nightly
- build: macos-nightly
os: macos-latest
rust: nightly
- build: windows-nightly
os: windows-latest
rust: nightly

steps:
- uses: actions/checkout@v1

- name: Cache Cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.build }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-${{ matrix.rust }}-cargo-registry-

- name: Cache Cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.build }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-${{ matrix.rust }}-cargo-index-

- name: Cache Cargo build
uses: actions/cache@v1
with:
path: target/debug
key: ${{ matrix.build }}-${{ matrix.rust }}-debug-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-${{ matrix.rust }}-debug-target-

- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}

- name: Run Tests
run: cargo test
env:
RUST_LOG: warn,wrangler=info
RUST_BACKTRACE: 1
Loading